Fixed #13158 -- Clarified that OneToOneField is a better option for User profile classes. Thanks to hvdklauw for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2010-05-10 11:38:37 +00:00
parent 95fea01041
commit b82a5b9dd0
1 changed files with 9 additions and 8 deletions

View File

@ -71,7 +71,7 @@ Fields
Required. 30 characters or fewer. Alphanumeric characters only Required. 30 characters or fewer. Alphanumeric characters only
(letters, digits and underscores). (letters, digits and underscores).
.. versionchanged:: 1.2 .. versionchanged:: 1.2
Usernames may now contain ``@``, ``+``, ``.`` and ``-`` characters. Usernames may now contain ``@``, ``+``, ``.`` and ``-`` characters.
@ -293,7 +293,7 @@ Manager functions
.. method:: models.UserManager.create_user(username, email, password=None) .. method:: models.UserManager.create_user(username, email, password=None)
Creates, saves and returns a :class:`~django.contrib.auth.models.User`. Creates, saves and returns a :class:`~django.contrib.auth.models.User`.
The :attr:`~django.contrib.auth.models.User.username` and The :attr:`~django.contrib.auth.models.User.username` and
:attr:`~django.contrib.auth.models.User.password` are set as given. The :attr:`~django.contrib.auth.models.User.password` are set as given. The
domain portion of :attr:`~django.contrib.auth.models.User.email` is domain portion of :attr:`~django.contrib.auth.models.User.email` is
@ -486,12 +486,13 @@ If you'd like to store additional information related to your users, Django
provides a method to specify a site-specific related model -- termed a "user provides a method to specify a site-specific related model -- termed a "user
profile" -- for this purpose. profile" -- for this purpose.
To make use of this feature, define a model with fields for the additional To make use of this feature, define a model with fields for the
information you'd like to store, or additional methods you'd like to have additional information you'd like to store, or additional methods
available, and also add a :class:`~django.db.models.Field.ForeignKey` from your you'd like to have available, and also add a
model to the :class:`~django.contrib.auth.models.User` model, specified with :class:`~django.db.models.Field.OneToOneField` from your model to the
``unique=True`` to ensure only one instance of your model can be created for :class:`~django.contrib.auth.models.User` model. This will ensure only
each :class:`~django.contrib.auth.models.User`. one instance of your model can be created for each
:class:`~django.contrib.auth.models.User`.
To indicate that this model is the user profile model for a given site, fill in To indicate that this model is the user profile model for a given site, fill in
the setting :setting:`AUTH_PROFILE_MODULE` with a string consisting of the the setting :setting:`AUTH_PROFILE_MODULE` with a string consisting of the