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
This commit is contained in:
Jannis Leidel 2010-01-19 22:19:26 +00:00
parent fb5f8d7b14
commit 5cd4c3e559
1 changed files with 5 additions and 5 deletions

View File

@ -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)