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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -