Wednesday, July 6, 2011

Generic ModelAdmin class

Hello everyone,

I have an abstract class that defines a base Model.
Given the fact that the extended models are quite identical, in order
to administrate these models, I use a generic ModelAdmin class.

To sum up:

class BaseClass(models.model):
...some fields...
class Meta:
abstract = True

class ClassA(BaseClass):
....

class ClassB(BaseClass):
....

class CommonModelAdmin(admin.ModelAdmin):
def my_custom_admin_view(self, request):
....

def get_urls(self)
....register the view....
....

admin.site.register(ClassA, CommonModelAdmin)
admin.site.register(ClassB, CommonModelAdmin)

I defined a custom admin view in which I would like to get the class
that is currently administered.
Is it possible to do it?

Thank you very much for your help


Regards,

Gontran

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate