[Django] #29753: User Admin models use `django.contrib.auth.models.User` instead of `User = get_user_model()`

7 views
Skip to first unread message

Django

unread,
Sep 12, 2018, 8:12:41 AM9/12/18
to django-...@googlegroups.com
#29753: User Admin models use `django.contrib.auth.models.User` instead of `User =
get_user_model()`
-----------------------------------------+------------------------
Reporter: Ariel Pontes | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I have a custom User model that is exactly the same as Django's default
User model except for the fact that we allow longer usernames (I'm on
Django 1.9, which has a 30 character limit on usernames). Because this is
the only difference, I use all default User models in the Admin. However,
when I try to create a user with a long username, I get the 30 character
limit error. In the shell everything works fine. When investigating I saw
that in the `django/contrib/auth/forms.py` file, the `UserCreationForm`
referred to `django.contrib.auth.models.User`. I believe it should refer
instead to `UserModel` (which is declared in the file using
`get_user_model()`).

Relevant lines:

*
https://github.com/django/django/blob/stable/2.1.x/django/contrib/auth/forms.py#L86
*
https://github.com/django/django/blob/stable/2.1.x/django/contrib/auth/forms.py#L135

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

Django

unread,
Sep 12, 2018, 10:06:30 AM9/12/18
to django-...@googlegroups.com
#29753: User Admin models use `django.contrib.auth.models.User` instead of `User =
get_user_model()`
-------------------------------+--------------------------------------

Reporter: Ariel Pontes | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 2.1
Severity: Normal | Resolution: duplicate

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

* status: new => closed
* resolution: => duplicate


Comment:

Duplicate of #28608.

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

Reply all
Reply to author
Forward
0 new messages