Skip to content

Instantly share code, notes, and snippets.

@joshourisman
Created October 15, 2009 15:04
Show Gist options
  • Save joshourisman/211008 to your computer and use it in GitHub Desktop.
Save joshourisman/211008 to your computer and use it in GitHub Desktop.
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