From 05b4f2ebc2f547d2413f738551f9933aae0d34dc Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Tue, 3 May 2011 13:52:39 +0000 Subject: Corrected the behavior of the SimpleFilter.lookups method to also be able to return None. Also modified example in documentation to be a bite more realistic. Refs #5833. Thanks for the hint, Martin Mahner. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16150 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/contrib/admin/index.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 0d28cc48ff..e8bc59724d 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -607,15 +607,12 @@ subclass:: class AuthDecadeBornListFilter(DecadeBornListFilter): def lookups(self, request): - if request.user.is_authenticated(): - return ( - ('80s', 'in the eighties'), - ('other', 'other'), - ) - else: - return ( - ('90s', 'in the nineties'), - ) + if request.user.is_superuser: + return super(AuthDecadeBornListFilter, self).lookups(request) + + def queryset(self, request, queryset): + if request.user.is_superuser: + return super(AuthDecadeBornListFilter, self).queryset(request, queryset) * a tuple, where the first element is a field name and the second element is a class inheriting from -- cgit v1.3