简体   繁体   中英

How to add Custom fields in User model in django?

我正在创建一个网站,在该网站上我需要用户在注册网站时提供额外信息,例如(他有没有电脑,是否订阅了时事通讯,电子邮件,电话号码和密码确认)注意:有没有办法让我可以使反应开发人员可以使用此模型吗?

You can find a good example how to extend the User object in the django documentation: https://docs.djangoproject.com/en/4.0/topics/auth/customizing/#extending-the-existing-user-model

If there is the need to completly replace the User model, there is a django way to do this as well: https://docs.djangoproject.com/en/4.0/topics/auth/customizing/#substituting-a-custom-user-model

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM