[Django] #25596: Can't change user's password in DjangoAdmin

27 views
Skip to first unread message

Django

unread,
Oct 22, 2015, 12:15:00 PM10/22/15
to django-...@googlegroups.com
#25596: Can't change user's password in DjangoAdmin
-------------------------------+--------------------
Reporter: user0007 | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.9a1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Django 1.9b1

I'm using custom User model which is defined as:

{{{
AUTH_USER_MODEL = 'users.User'

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
...
'apps.users',
]
}}}

When I tried to change user's password (using
/admin/users/user/ID/password/) I've got an error:

{{{Traceback:

File "/src/django/django/core/handlers/base.py" in get_response
149. response =
self.process_exception_by_middleware(e, request)

File "/src/django/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request,
*callback_args, **callback_kwargs)

File "/src/django/django/utils/decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)

File "/src/django/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)

File "/src/django/django/contrib/admin/sites.py" in inner
244. return view(request, *args, **kwargs)

File "/src/django/django/utils/decorators.py" in _wrapper
67. return bound_func(*args, **kwargs)

File "/src/django/django/views/decorators/debug.py" in
sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)

File "/src/django/django/utils/decorators.py" in bound_func
63. return func.__get__(self, type(self))(*args2,
**kwargs2)

File "/src/django/django/contrib/auth/admin.py" in user_change_password
155. args=(user.pk,),

File "/src/django/django/core/urlresolvers.py" in reverse
600. return
force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args,
**kwargs)))

File "/src/django/django/core/urlresolvers.py" in _reverse_with_prefix
508. (lookup_view_s, args, kwargs,
len(patterns), patterns))

Exception Type: NoReverseMatch at /panel/users/user/8/password/
Exception Value: Reverse for 'auth_user_change' with arguments '(8,)' and
keyword arguments '{}' not found. 0 pattern(s) tried: []
}}}

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

Django

unread,
Oct 22, 2015, 12:19:03 PM10/22/15
to django-...@googlegroups.com
#25596: Can't change user's password in DjangoAdmin when using custom User model
-------------------------------+--------------------------------------

Reporter: user0007 | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.9a1
Severity: Normal | Resolution:
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 user0007):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

New description:

Django 1.9b1

{{{
AUTH_USER_MODEL = 'users.User'

Traceback:

{{{

django/auth/admin.py:151
{{{
reverse(
'%s:auth_%s_change' % (
self.admin_site.name,
user._meta.model_name,
),
args=(user.pk,),
)
}}}

There should not be fixed "auth_" prefix, but something like
user._meta.app_name(?)

--

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

Django

unread,
Oct 22, 2015, 12:31:54 PM10/22/15
to django-...@googlegroups.com
#25596: Can't change user's password in admin when using custom User model
---------------------------------+------------------------------------
Reporter: user0007 | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.9b1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* version: 1.9a1 => 1.9b1
* type: Uncategorized => Bug
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Regression due to 50aa1a790ca66c2a93e0a52e00c53375b269ff49. Looks like
hardcoded "auth" should be `user._meta.app_label` as you suggested.

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

Django

unread,
Oct 24, 2015, 7:52:02 PM10/24/15
to django-...@googlegroups.com
#25596: Can't change user's password in admin when using custom User model
---------------------------------+-------------------------------------
Reporter: user0007 | Owner: timgraham
Type: Bug | Status: assigned

Component: contrib.admin | Version: 1.9b1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

I'm looking into how to write a regression test for this.

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

Django

unread,
Oct 26, 2015, 6:48:40 PM10/26/15
to django-...@googlegroups.com
#25596: Can't change user's password in admin when using custom User model
---------------------------------+-------------------------------------
Reporter: user0007 | Owner: timgraham
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.9b1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1


Comment:

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

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

Django

unread,
Oct 27, 2015, 8:38:15 AM10/27/15
to django-...@googlegroups.com
#25596: Can't change user's password in admin when using custom User model
---------------------------------+-------------------------------------
Reporter: user0007 | Owner: timgraham
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.9b1
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"5acf203db2e9562dbe4073bf85d5043ef3121ea9" 5acf203]:
{{{
#!CommitTicketReference repository=""
revision="5acf203db2e9562dbe4073bf85d5043ef3121ea9"
Fixed #25596 -- Fixed regression in password change view with custom user
model.

The reverse() added in 50aa1a790ca66c2a93e0a52e00c53375b269ff49
crashed on a custom user model.
}}}

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

Django

unread,
Oct 27, 2015, 8:44:37 AM10/27/15
to django-...@googlegroups.com
#25596: Can't change user's password in admin when using custom User model
---------------------------------+-------------------------------------
Reporter: user0007 | Owner: timgraham
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.9b1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"0b4d11e1751a4e2368f0e4faa121e10ff1f73167" 0b4d11e1]:
{{{
#!CommitTicketReference repository=""
revision="0b4d11e1751a4e2368f0e4faa121e10ff1f73167"
[1.9.x] Fixed #25596 -- Fixed regression in password change view with
custom user model.

The reverse() added in 50aa1a790ca66c2a93e0a52e00c53375b269ff49
crashed on a custom user model.

Backport of 5acf203db2e9562dbe4073bf85d5043ef3121ea9 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages