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:
parent
fb5f8d7b14
commit
5cd4c3e559
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user