diff options
| author | Alasdair Nicol <alasdair@thenicols.net> | 2015-06-05 14:33:04 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-06-06 09:33:02 -0400 |
| commit | 1ea87c8c7974acb5fa795362253c61b38f3cb137 (patch) | |
| tree | 2192bdc6b85457eb4352563a1d9976f37c3a80cc /docs | |
| parent | a391b17ad24bc5f255a3928c23c158c79004c656 (diff) | |
Fixed #24910 -- Added createsuperuser support for non-unique USERNAME_FIELDs
Clarified docs to say that a non-unique USERNAME_FIELD is permissable
as long as the custom auth backend can support it.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/auth/customizing.txt | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt index 6d06ef6e25..7745574d5d 100644 --- a/docs/topics/auth/customizing.txt +++ b/docs/topics/auth/customizing.txt @@ -477,9 +477,11 @@ Specifying a custom User model Django expects your custom User model to meet some minimum requirements. -#. Your model must have a single unique field that can be used for - identification purposes. This can be a username, an email address, - or any other unique attribute. +#. 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 + be a username, an email address, or any other unique attribute. A non-unique + username field is allowed if you use a custom authentication backend that + can support it. #. Your model must provide a way to address the user in a "short" and "long" form. The most common interpretation of this would be to use @@ -506,10 +508,11 @@ password resets. You must then provide some key implementation details: .. attribute:: USERNAME_FIELD A string describing the name of the field on the User model that is - used as the unique identifier. This will usually be a username of - some kind, but it can also be an email address, or any other unique - identifier. The field *must* be unique (i.e., have ``unique=True`` - set in its definition). + used as the unique identifier. This will usually be a username of some + kind, but it can also be an email address, or any other unique + identifier. The field *must* be unique (i.e., have ``unique=True`` set + in its definition), unless you use a custom authentication backend that + can support non-unique usernames. In the following example, the field ``identifier`` is used as the identifying field:: |
