Created
October 15, 2009 15:04
-
-
Save joshourisman/211008 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThisAdmin(admin.ModelAdmin): | |
def queryset(self, request): | |
""" | |
Filter the objects displayed in the change_list to only | |
display those for the currently signed in user. | |
""" | |
qs = super(ThisAdmin, self).queryset(request) | |
if request.user.is_superuser: | |
return qs | |
return qs.filter(Q(owner=request.user) | Q(editors=request.user)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment