1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

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

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)