Fixed #20646 -- Clarified the use of AbstractBaseUser.REQUIRED_FIELDS

Thanks craigbruce.
This commit is contained in:
Tim Graham 2013-09-06 16:01:29 -04:00
parent df462cf760
commit db3de52807
1 changed files with 9 additions and 7 deletions

View File

@ -470,13 +470,15 @@ password resets. You must then provide some key implementation details:
.. attribute:: REQUIRED_FIELDS .. attribute:: REQUIRED_FIELDS
A list of the field names that *must* be provided when creating a user A list of the field names that will be prompted for when creating a
via the :djadmin:`createsuperuser` management command. The user will be user via the :djadmin:`createsuperuser` management command. The user
prompted to supply a value for each of these fields. It should include will be prompted to supply a value for each of these fields. It must
any field for which :attr:`~django.db.models.Field.blank` is ``False`` include any field for which :attr:`~django.db.models.Field.blank` is
or undefined, but may include additional fields you want prompted for ``False`` or undefined and may include additional fields you want
when a user is created interactively. However, it will not work for prompted for when a user is created interactively. However, it will not
:class:`~django.db.models.ForeignKey` fields. work for :class:`~django.db.models.ForeignKey` fields.
``REQUIRED_FIELDS`` has no effect in other parts of Django, like
creating a user in the admin.
For example, here is the partial definition for a ``User`` model that For example, here is the partial definition for a ``User`` model that
defines two required fields - a date of birth and height:: defines two required fields - a date of birth and height::