[Django]-Group models from different app/object into one Admin block

45👍

Django Admin groups Models to admin block by their apps which is defined by Model._meta.app_label. Thus registering Review in followers/admin.py still gets it to app review.

So make a proxy model of Review and put it in the ‘review’ app

class ProxyReview(Review):
    class Meta:
        proxy = True    
        # If you're define ProxyReview inside review/models.py,
        #  its app_label is set to 'review' automatically.
        # Or else comment out following line to specify it explicitly               
        # app_label = 'review'

        # set following lines to display ProxyReview as Review
        # verbose_name = Review._meta.verbose_name
        # verbose_name_plural = Review._meta.verbose_name_plural


# in admin.py
admin.site.register(ProxyReview)

Also, you could put Followers and Review to same app or set same app_label for them.

Customize admin view or use 3rd-part dashboard may achieve the goal also.

👤okm

Leave a comment