简体   繁体   English

可以使用Django的auth_user模型存储用户信息吗

[英]Is it okay to use django's auth_user model for storing user's info

If I am trying to create a login app for my project is it advisable to use auth_user as the model to store newly created user's in and just extend in in my signup app through: 如果我要为我的项目创建一个登录应用程序,建议使用auth_user作为模型来存储新创建的用户的身份,并通过以下方式在我的注册应用程序中进行扩展:

from auth.models import User

class UserForm(ModelForm):
    class Meta:
        model=User

Or is it better to create a custom model to store users in. Will what I have above even work? 还是创建一个自定义模型来存储用户会更好。我上面的东西还能用吗? I'm sure the answer is either "of course, that's what it's there for" or "dear god why would you want to do that" but I don't know which. 我敢肯定答案是“当然,这就是它的作用”或“亲爱的上帝,你为什么要这么做”,但我不知道是哪个。

User is meant to store the credentials of users that will be able to log into and use the system via normal Django auth mechanisms. User旨在存储将能够通过常规Django身份验证机制登录并使用系统的用户凭据。 If your project will use Django's auth then yes, User is the correct model to use. 如果您的项目将使用Django的auth,则是, User是要使用的正确模型。

The short answer is yes. 简短的答案是肯定的。 and if you want to store additional information of the user, you could create another model and a foreign key to the user model. 如果要存储用户的其他信息,则可以创建另一个模型和该用户模型的外键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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