To add Multiple ModelAdmins/views for same model in Python Django admin, we can call register with different ModelAdmin and model classes.
For instance, we write
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)
to call admin.site.register with the Post model and PostAdmin model admin classes.
And we call admin.site.register with the MyPost model and MyPostAdmin model admin classes.