Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. from django.contrib import admin
  2. from more_with_admin.examples import models
  3.  
  4. class DocumentAdmin(admin.ModelAdmin):
  5.    
  6.     def queryset(self, request):
  7.         qs = super(DocumentAdmin, self).queryset(request)
  8.  
  9.         # If super-user, show all comments
  10.         if request.user.is_superuser:
  11.             return qs
  12.        
  13.         return qs.filter(added_by=request.user)