Friday, July 4, 2014

How to create a custom admin panel for many models

I want to create a custom ModelAdmin, but for a mix of models, not just one.

I have two example models:

class Article(models.Model):      author = models.GenericIPAddressField()      # ...    class Comment(models.Model):      author = models.GenericIPAddressField()      # ...

Now I want to be able to have a ModelAdmin with fields:

author  number_of_comments  number_of_articles

How can I achieve it?

I created a new ModelAdmin with overridden queryset method, but I was not able to register it, because Article and Comment are already registered.

--
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+unsubscribe@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/0a2d344f-755d-4108-83bd-2c672cce4e30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment