From 4b4168b1bf74ec2abe6c2fb10a80f426d860e952 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Fri, 3 Sep 2010 18:58:53 +0000 Subject: [PATCH] Fixed #14090 - Many sql queries needed to display change user form Thanks to Suor for report and patch. Backport for [13683] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13684 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/auth/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index 086acf3349..992a0ff44d 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -52,6 +52,10 @@ class UserChangeForm(forms.ModelForm): class Meta: model = User + 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') + class AuthenticationForm(forms.Form): """ Base class for authenticating users. Extend this to get a form that accepts