[Django] #28667: Lack of clear documentation for custom UserCreationForm when using a custom User model

63 views
Skip to first unread message

Django

unread,
Oct 1, 2017, 9:15:24 PM10/1/17
to django-...@googlegroups.com
#28667: Lack of clear documentation for custom UserCreationForm when using a custom
User model
-------------------------------------+-------------------------------------
Reporter: Nathanael | Owner: nobody
Gordon |
Type: Bug | Status: new
Component: | Version: 1.11
contrib.auth | Keywords: add_fieldsets
Severity: Normal | UserAdmin UserCreationForm Custom
Triage Stage: | Auth User Model
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
In the docs for customising the Auth User model it does not fully outline
the link between the UserCreationForm and the UserAdmin - specifically the
fact that the UserAdmin's `add_fieldsets` will be used rather than the
`fields` attribute in the `Meta` for the custom `UserCreationForm`.

At the end of this section
(https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#custom-
users-and-the-built-in-auth-forms) it specifies that one can simply
override the `fields` in the `Meta` of one's `UserCreationForm`. However,
as the UserAdmin uses a custom `get_fieldsets` method which uses its
`add_fieldsets` attribute instead, overriding `fields` does nothing.

--
Ticket URL: <https://code.djangoproject.com/ticket/28667>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 2, 2017, 9:33:09 AM10/2/17
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted
* type: Bug => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:1>

Django

unread,
Oct 4, 2017, 11:41:35 AM10/4/17
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: messfish
Type: | Status: assigned

Cleanup/optimization |
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by messfish):

* owner: nobody => messfish
* status: new => assigned


Comment:

I would like to fix this minor problem to let me have a better grasp of
django.

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:2>

Django

unread,
Mar 16, 2018, 12:53:01 AM3/16/18
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Bhavesh
Type: | Praveen
Cleanup/optimization | Status: assigned

Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Bhavesh Praveen):

* owner: messfish => Bhavesh Praveen


--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:3>

Django

unread,
Sep 19, 2018, 4:21:58 AM9/19/18
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Dunstrom
Type: | Status: assigned
Cleanup/optimization |

Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Dunstrom):

* owner: nobody => Dunstrom


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:2>

Django

unread,
Oct 2, 2018, 2:20:19 AM10/2/18
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Hampus
Type: | Dunström
Cleanup/optimization | Status: assigned

Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Hampus Dunström):

I plan to be done with this at the end of October.

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:3>

Django

unread,
Oct 4, 2018, 7:23:34 AM10/4/18
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Hampus
Type: | Dunström
Cleanup/optimization | Status: assigned
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Hampus Dunström):

I'm having a hard time creating a test app with a `UserCreationForm` for a
model based on the `django.contrib.auth.admin.UserAdmin` class. Is this
not the class. Is there any example code anyone can show me?

> At the end of this section
(​https://docs.djangoproject.com/en/1.11/topics/auth/customizing/#custom-
users-and-the-built-in-auth-forms) it specifies that one can simply

override the fields in the Meta of one's UserCreationForm.

Above this example it is stated that it only works if the model is a
simple subclass of `AbstractUser`. Do we want another example for
`UserAdmin` or what are we looking for? Maybe I'm not the right person for
this issue, I don't know. If any of you guys know anything or can clarify
please let me know.

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:4>

Django

unread,
Oct 23, 2018, 2:51:21 AM10/23/18
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: (none)
Type: | Status: new
Cleanup/optimization |

Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hampus Dunström):

* owner: Hampus Dunström => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:5>

Django

unread,
Oct 23, 2018, 3:15:09 PM10/23/18
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: eadhina
Type: | Status: assigned

Cleanup/optimization |
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by eadhina):

* status: new => assigned

* owner: (none) => eadhina


--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:6>

Django

unread,
Mar 18, 2019, 6:58:34 AM3/18/19
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: (none)
Type: | Status: new

Cleanup/optimization |
Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* owner: eadhina => (none)


* status: assigned => new


Comment:

Given the lack of updates I'm going to de-assign this issue so someone
else looking can pick it up.

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:7>

Django

unread,
Mar 24, 2019, 1:56:52 PM3/24/19
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner:
Type: | armansabyr
Cleanup/optimization | Status: assigned

Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by armansabyr):

* owner: (none) => armansabyr


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:8>

Django

unread,
Jun 22, 2019, 4:11:38 AM6/22/19
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Swatantra
Type: | Status: assigned
Cleanup/optimization |

Component: contrib.auth | Version: 1.11
Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Swatantra):

* owner: (none) => Swatantra


* status: new => assigned

Django

unread,
Jul 3, 2019, 2:29:13 AM7/3/19
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Swatantra
Type: | Status: assigned
Cleanup/optimization |
Component: contrib.auth | Version: 2.2

Severity: Normal | Resolution:
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1
* version: 1.11 => 2.2


Comment:

[https://github.com/django/django/pull/11515 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:9>

Django

unread,
Jul 4, 2019, 2:23:40 AM7/4/19
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Swatantra
Type: | Status: closed

Cleanup/optimization |
Component: contrib.auth | Version: 2.2
Severity: Normal | Resolution: fixed

Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c13e3715f5f46f2ee4ddba357e2589a45e831813" c13e3715]:
{{{
#!CommitTicketReference repository=""
revision="c13e3715f5f46f2ee4ddba357e2589a45e831813"
Fixed #28667 -- Clarified how to override list of forms fields for custom
UserAdmin with a custom user model.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:10>

Django

unread,
Jul 4, 2019, 2:23:49 AM7/4/19
to django-...@googlegroups.com
#28667: Documentation for extending UserCreationForm doesn't work with UserAdmin
-------------------------------------+-------------------------------------
Reporter: Nathanael Gordon | Owner: Swatantra
Type: | Status: closed
Cleanup/optimization |
Component: contrib.auth | Version: 2.2
Severity: Normal | Resolution: fixed
Keywords: add_fieldsets | Triage Stage: Accepted
UserAdmin UserCreationForm Custom |
Auth User Model |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"7d52d056e370734f3938d7cf3ab30e06205f1f85" 7d52d056]:
{{{
#!CommitTicketReference repository=""
revision="7d52d056e370734f3938d7cf3ab30e06205f1f85"
[2.2.x] Fixed #28667 -- Clarified how to override list of forms fields for


custom UserAdmin with a custom user model.

Backport of c13e3715f5f46f2ee4ddba357e2589a45e831813 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28667#comment:11>

Reply all
Reply to author
Forward
0 new messages