mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Fixed #14242 - UserChangeForm subclasses without 'user_permissions' field causes KeyError
This was a regression introduced by [13683] Thanks to adammckerlie@gmail.com for report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13702 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -54,7 +54,9 @@ class UserChangeForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(UserChangeForm, self).__init__(*args, **kwargs)
|
||||
self.fields['user_permissions'].queryset = self.fields['user_permissions'].queryset.select_related('content_type')
|
||||
f = self.fields.get('user_permissions', None)
|
||||
if f is not None:
|
||||
f.queryset = f.queryset.select_related('content_type')
|
||||
|
||||
class AuthenticationForm(forms.Form):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user