Fixed #20629 -- Rephrased custom user models admonition.

This commit is contained in:
Tobias Kunze 2019-04-27 18:32:27 +02:00 committed by Mariusz Felisiak
parent a8b3f96f6a
commit eb16c7260e
1 changed files with 10 additions and 11 deletions

View File

@ -511,18 +511,17 @@ different user model.
Specifying a custom user model Specifying a custom user model
------------------------------ ------------------------------
.. admonition:: Model design considerations When you start your project with a custom user model, stop to consider if this
is the right choice for your project.
Think carefully before handling information not directly related to Keeping all user related information in one model removes the need for
authentication in your custom user model. additional or more complex database queries to retrieve related models. On the
other hand, it may be more suitable to store app-specific user information in a
It may be better to store app-specific user information in a model model that has a relation with your custom user model. That allows each app to
that has a relation with the user model. That allows each app to specify specify its own user data requirements without potentially conflicting or
its own user data requirements without risking conflicts with other breaking assumptions by other apps. It also means that you would keep your user
apps. On the other hand, queries to retrieve this related information model as simple as possible, focused on authentication, and following the
will involve a database join, which may have an effect on performance. minimum requirements Django expects custom user models to meet.
Django expects your custom user model to meet some minimum requirements.
If you use the default authentication backend, then your model must have a If you use the default authentication backend, then your model must have a
single unique field that can be used for identification purposes. This can single unique field that can be used for identification purposes. This can