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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1c16dc8-53fd-42bd-b4cd-72489ed5ab1f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to