summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnubhav Joshi <anubhav9042@gmail.com>2014-06-30 18:36:28 +0530
committerTim Graham <timograham@gmail.com>2014-07-03 07:42:52 -0400
commit9bc2d766a0c31701a4c0e20a8b04164bb22cf6d5 (patch)
tree478a6119acaed199052bbf37ec6ab7ce01d26080 /docs
parent23d68c0f0d705fede71e1a99625d9988a63cdad3 (diff)
Fixed #21755 -- Added ForeignKey support to REQUIRED_FIELDS.
This allows specifying ForeignKeys in REQUIRED_FIELDS when using a custom User model. Thanks cjerdonek and bmispelon for suggestion and timgraham for review.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.8.txt2
-rw-r--r--docs/topics/auth/customizing.txt12
2 files changed, 12 insertions, 2 deletions
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 3e2790c602..70858869c9 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -49,6 +49,8 @@ Minor features
* The ``max_length`` of :attr:`Permission.name
<django.contrib.auth.models.Permission.name>` has been increased from 50 to
255 characters. Please run the database migration.
+* :attr:`~django.contrib.auth.models.CustomUser.REQUIRED_FIELDS` now supports
+ :class:`~django.db.models.ForeignKey`\s.
:mod:`django.contrib.formtools`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt
index a70753132c..0b0582775a 100644
--- a/docs/topics/auth/customizing.txt
+++ b/docs/topics/auth/customizing.txt
@@ -515,8 +515,7 @@ password resets. You must then provide some key implementation details:
will be prompted to supply a value for each of these fields. It must
include any field for which :attr:`~django.db.models.Field.blank` is
``False`` or undefined and may include additional fields you want
- prompted for when a user is created interactively. However, it will not
- work for :class:`~django.db.models.ForeignKey` fields.
+ prompted for when a user is created interactively.
``REQUIRED_FIELDS`` has no effect in other parts of Django, like
creating a user in the admin.
@@ -536,6 +535,15 @@ password resets. You must then provide some key implementation details:
``User`` model, but should *not* contain the ``USERNAME_FIELD`` or
``password`` as these fields will always be prompted for.
+ .. versionadded:: 1.8
+
+ :attr:`REQUIRED_FIELDS` now supports
+ :class:`~django.db.models.ForeignKey`\s. Since there is no way to pass
+ model instances during the :djadmin:`createsuperuser` prompt, expect the
+ user to enter the value of :attr:`~django.db.models.ForeignKey.to_field`
+ value (the :attr:`~django.db.models.Field.primary_key` by default) of an
+ existing instance.
+
.. attribute:: is_active
A boolean attribute that indicates whether the user is considered