Opened 7 years ago

Closed 7 years ago

#8327 closed (invalid)

link to change password form on 'change user' page in admin interface is broken

Reported by: tobias Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Go into the admin interface, open a user, and try to change its password.

Environment:

Request Method: GET
Request URL: http://localhost:8000/bradmin/auth/user/9/password/
Django Version: 1.0-alpha_2-SVN-8351
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.humanize',
 'visitdb',
 'photologue']
Installed Middleware:
('visitdb.middleware.RequestAttributeSetup',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'visitdb.middleware.StandardViewKwargsMiddleware')


Traceback:
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/core/handlers/base.py" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/sites.py" in root
  172.                 return self.model_page(request, *url.split('/', 2))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/sites.py" in model_page
  189.         return admin_obj(request, rest_of_url)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/options.py" in __call__
  275.             return self.change_view(request, unquote(url))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/transaction.py" in _commit_on_success
  238.                 res = func(*args, **kw)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/options.py" in change_view
  616.             obj = model._default_manager.get(pk=object_id)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/manager.py" in get
  81.         return self.get_query_set().get(*args, **kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/query.py" in get
  294.         clone = self.filter(*args, **kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/query.py" in filter
  481.         return self._filter_or_exclude(False, *args, **kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/query.py" in _filter_or_exclude
  499.             clone.query.add_q(Q(*args, **kwargs))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/sql/query.py" in add_q
  1166.                         can_reuse=used_aliases)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/sql/query.py" in add_filter
  1113.         self.where.add((alias, col, field, lookup_type, value), connector)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/sql/where.py" in add
  48.                 params = field.get_db_prep_lookup(lookup_type, value)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/fields/__init__.py" in get_db_prep_lookup
  214.             return [self.get_db_prep_value(value)]
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/db/models/fields/__init__.py" in get_db_prep_value
  439.         return int(value)

Exception Type: ValueError at /bradmin/auth/user/9/password/
Exception Value: invalid literal for int() with base 10: '9/password'

Change History (6)

comment:1 Changed 7 years ago by brosner

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I can't reproduce this. Are you doing any admin modification with regards to UserAdmin or templates?

comment:2 Changed 7 years ago by tobias

nope. I don't know what UserAdmin is, so I'm assuming not, and I definitely haven't created any templates for the admin interface. It seems like maybe the URL parsing is broken? Like there should be a (\d+) somewhere, but there's a (\w+) instead? I'm using 8351.

comment:3 Changed 7 years ago by tobias

on closer examination, the change password link in the "default" (?) admin (admin.site) works, but the link in my custom admin does not.

comment:4 Changed 7 years ago by brosner

Ah, see now we are getting somewhere. Can you show your code for your AdminSite?

comment:5 Changed 7 years ago by tobias

bradmin = admin.AdminSite()

class UserAdmin(admin.ModelAdmin):
	fields = ('first_name', 'last_name', 'email', 'password', 'groups', 'last_login', 'date_joined')
	list_display = ('last_name', 'first_name', 'email', 'last_login')
	search_fields = ('email', 'first_name', 'last_name',)
	list_filter = ('groups',)
	ordering = ('last_name',)
bradmin.register(User, UserAdmin)

class SiteAdmin(admin.ModelAdmin):
	search_fields = ('name',)
bradmin.register(visitdb.Site, SiteAdmin)

bradmin.register(visitdb.Business)

class TeamAdmin(admin.ModelAdmin):
	fields = ('physician', 'members')
	search_fields = ('physician', 'members')
bradmin.register(visitdb.Team, TeamAdmin)

comment:6 Changed 7 years ago by brosner

  • Resolution set to invalid
  • Status changed from new to closed

Ok. Yep there is your problem. And you *do* know what a UserAdmin is. You are trying to replace it! :) Make sure when you replace the UserAdmin that you properly subclass django.contrib.auth.admin.UserAdmin and not just admin.ModelAdmin.

Note: See TracTickets for help on using tickets.
Back to Top