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
Post a Comment