开发者

Why does django not do for the User model the same as it does for the userprofile model?

Why doesn't django just have the model to use for User configured in the settings file?

The requirements on the model specified would be t开发者_开发技巧hat it contain a certain set of fields.

Is there a reason why it couldn't be done this way?


The User model has a lot of dependencies and must conform to a diverse set of API requirements in order to interoperate with the rest of the django framework. This is because of its relationship with authentication and authorization. Changing User means changing the expected behavior of contrib.auth. If you want to do that, you can, and that is configurable in settings.py.

More likely, what you want to configure is the extra metadata that relates with users. This extra info isn't in any way involved with authentication, and so it can be configured separately without affecting contrib.auth. In order to make the dependencies easy to manage, this is handled in a separate model. This has the added benefit of making the distinction between authorization dependent data and site specific user metadata much clearer.


"Why doesn't django just have the model to use for User configured in the settings file?"

I have a site that doesn't need users or a login or authentication.

I don't want the model for User.

In order to support everyone with applications like mine, User is optional.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜