First of all I’m a python newbie.
I’m playing with Django and I’m trying to extend some classes.
Now I’m in this situation:
I have a new class
customBaseModelAdmin(admin.options.BaseModelAdmin):
#override a method of BaseModelAdmin
and I want to write another class
customModelAdmin(customBaseModelAdmin):
that obviously inherits customBaseModelAdmin, but that has the same methods of the standard ModelAdmin.
But, since the standard ModelAdmin inherits the standard BaseModelAdmin, how can I do?
I tried with the definition
class customModelAdmin(customBaseModelAdmin, admin.options.ModelAdmin):
but it doesn’t work.
Do you have any suggestion?
Thanks,
Giovanni
Just let
customBaseModelAdmininherit fromModelAdmin. You can still override the method fromBaseModelAdmin.But of course it could be that
ModelAdminalso overrides this method. I would take a look at the source code of these classes to really know what is going on there.