Multiple ModelAdmins/views for same model in Django admin

I’ve found one way to achieve what I want, by using proxy models to get around the fact that each model may be registered only once. class PostAdmin(admin.ModelAdmin): list_display = (‘title’, ‘pubdate’,’user’) class MyPost(Post): class Meta: proxy = True class MyPostAdmin(PostAdmin): def get_queryset(self, request): return self.model.objects.filter(user = request.user) admin.site.register(Post, PostAdmin) admin.site.register(MyPost, MyPostAdmin) Then the default … Read more

Can “list_display” in a Django ModelAdmin display attributes of ForeignKey fields?

As another option, you can do look ups like: class UserAdmin(admin.ModelAdmin): list_display = (…, ‘get_author’) def get_author(self, obj): return obj.book.author get_author.short_description = ‘Author’ get_author.admin_order_field = ‘book__author’ Since Django 3.2 you can use display() decorator: class UserAdmin(admin.ModelAdmin): list_display = (…, ‘get_author’) @display(ordering=’book__author’, description=’Author’) def get_author(self, obj): return obj.book.author

How to override and extend basic Django admin templates?

Update: Read the Docs for your version of Django. e.g. https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#admin-overriding-templates https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#admin-overriding-templates https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#admin-overriding-templates Original answer from 2011: I had the same issue about a year and a half ago and I found a nice template loader on djangosnippets.org that makes this easy. It allows you to extend a template in a specific app, giving you … Read more