From 5cd4c3e5595128bc1a3f28f2e30bab2e4dd3b1b7 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Tue, 19 Jan 2010 22:19:26 +0000 Subject: [PATCH] Fixed #12644 - Allow overriding the admin user creation form based on r12216. Thanks, minmax. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12265 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/auth/admin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py index 81a963d015..b444fa5bac 100644 --- a/django/contrib/auth/admin.py +++ b/django/contrib/auth/admin.py @@ -62,11 +62,11 @@ class UserAdmin(admin.ModelAdmin): Use special form during user creation """ defaults = {} - if not obj: - defaults = { - 'form': UserCreationForm, - 'fields': ['username'], - } + if obj is None: + defaults.update({ + 'form': self.add_form, + 'fields': admin.util.flatten_fieldsets(self.add_fieldsets), + }) defaults.update(kwargs) return super(UserAdmin, self).get_form(request, obj, **defaults)