[Django] #24087: django.contrib.forms.UserCreationForm inheritence won't work

5 views
Skip to first unread message

Django

unread,
Jan 6, 2015, 12:43:59 PM1/6/15
to django-...@googlegroups.com
#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.

Django

unread,
Jan 6, 2015, 12:49:38 PM1/6/15
to django-...@googlegroups.com
#24087: django.contrib.forms.UserCreationForm inheritence won't work
-------------------------------------+-------------------------------------
Reporter: sh4r3m4n | Owner: nobody
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
forms,auth,users,custom | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0


Comment:

Duplicate of #19353

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

Reply all
Reply to author
Forward
0 new messages