Django administration panel filter list -


i have django model: post

any post has author (user|admin)

i add post's administration in django administration panel show in posts list posts author=admin.

is possible this?

generally speaking it's better create custom view purpose (in public section of site). if prefer use admin can try get_queryset method. example if want show posts admins , own posts simple users smth (copied official docs link above):

class postadmin(admin.modeladmin):     def get_queryset(self, request):         qs = super(postadmin, self).get_queryset(request)         if request.user.is_superuser:             return qs         return qs.filter(author=request.user) 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -