#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.26fa7fe7aedea7b812160705872513fc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to