In Django's admin.py
, why, even though this works:
class StudentAdmin(UserAdmin):
add_form = UserCreationForm
form = CustomChangeForm
fieldsets = UserAdmin.fieldsets
these do not?
class StudentAdmin(UserAdmin):
add_form = UserCreationForm
form = CustomChangeForm
def get_fieldsets(self, request, obj = None):
return UserAdmin.fieldsets
or
class StudentAdmin(UserAdmin):
add_form = UserCreationForm
form = CustomChangeForm
def get_fieldsets(self, request, obj = None):
return super(UserAdmin, self).get_fieldsets(request, obj)
Shouldn't they be equivalent?
The second set gives me an exception u"Key 'password' not found in Form"
, while the first one works fine.
The point, in the long term, is obviously to get more specific things working, but first I'd like to figure out what I got wrong so far.
Similarly, adding:
inlines = (MyInline,)
to the class works. But adding this:
def get_inline_instances(self, request, obj=None):
return (MyInline,)
throws the exception: unbound method get_formset() must be called with MyInline instance as first argument (got WSGIRequest instance instead)
. To the extent of my understanding, these two should also be equivalent.
Thanks.