Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14242 closed (fixed)

UserChangeForm Causes KeyError in 1.2.2 and Trunk

Reported by: adammckerlie@… Owned by: lukeplant
Component: Forms Version: 1.2
Severity: Keywords: UserChangeForm, KeyError, 1.2.2, trunk
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by kmtracey)

When using a the UserChangeForm in 1.2.2 or Trunk it causes a KeyError. The same code works fine in 1.2.1 and below.

Here's the code that I'm using http://dpaste.com/241056/

Traceback

Environment:

Request Method: GET
Request URL: http://polarisdev.gap.ca/polaris_django/gapsource/manage/users/edit/40318/
Django Version: 1.2.2
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'djangobb_forum',
 'djapian',
 'messages',
 'directory',
 'users',
 'contracts',
 'news',
 'polls',
 'gapsource',
 'moderation']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django_authopenid.middleware.OpenIDMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'djangobb_forum.middleware.LastLoginMiddleware',
 'djangobb_forum.middleware.UsersOnline',
 'django.middleware.cache.UpdateCacheMiddleware',
 'users.middleware.LoginFromPHP')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  69.         response = view_func(request, *args, **kwargs)
File "/home/webdev/web/virtualenvs/polaris/polaris/apps/gapsource/views.py" in users_add
  269.         dict['form'] = UserForm(instance = user)
File "/home/webdev/web/virtualenvs/polaris/polaris/apps/gapsource/forms.py" in __init__
  44.         super(UserForm, self).__init__(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/auth/forms.py" in __init__
  57.         self.fields['user_permissions'].queryset = self.fields['user_permissions'].queryset.select_related('content_type')

Exception Type: KeyError at /gapsource/manage/users/edit/40318/
Exception Value: 'user_permissions'

Attachments (0)

Change History (6)

comment:1 Changed 4 years ago by anonymous

  • Component changed from Uncategorized to Forms
  • Keywords UserChangeForm, KeyError, 1.2.2, trunk added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by adammckerlie@…

Here's a link to the traceback since the Wiki edited it.

http://dpaste.com/241054/

comment:3 Changed 4 years ago by kmtracey

  • Description modified (diff)

comment:4 Changed 4 years ago by lukeplant

  • Owner changed from nobody to lukeplant
  • Status changed from new to assigned

comment:5 Changed 4 years ago by lukeplant

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [13702]) Fixed #14242 - UserChangeForm subclasses without 'user_permissions' field causes KeyError

This was a regression introduced by [13683]

Thanks to adammckerlie@… for report.

comment:6 Changed 4 years ago by lukeplant

(In [13704]) [1.2.X] Fixed #14242 - UserChangeForm subclasses without 'user_permissions' field causes KeyError

This was a regression introduced by [13684]

Thanks to adammckerlie@… for report.

Backport of [13702] from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.