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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -