On Wed, Jul 6, 2011 at 3:22 PM, gontran <[email protected]> wrote:
> 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
>

Do you mean, "in a ModelAdmin subclass instance, how do I get the
model class that instance is associated with?"? If so, self.model.

Cheers

Tom

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

Reply via email to