#24087: django.contrib.forms.UserCreationForm inheritence won't work
------------------------------+-------------------------------------
Reporter: sh4r3m4n | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 1.7
Severity: Normal | Keywords: forms,auth,users,custom
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+-------------------------------------
If I create a custom User model based on AbstractUser, i should also
create a custom user creation form, inheriting from
django.contrib.forms.UserCreationForm and defining the custom model I
created in the Meta subclass. This won't work properly because
UserCreationForm always use auth.User model when cleaning the username
instead of the one defined in Meta.
This should be patched changing lines 101 and 102 of
contrib/auth/forms.py, from this:
101 User._default_manager.get(username=username)
102 except User.DoesNotExist:
To this
101 self.Meta.model._default_manager.get(username=username)
102 except self.Meta.model.DoesNotExist:
--
Ticket URL: <https://code.djangoproject.com/ticket/24087>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.