diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-05-03 13:52:39 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-05-03 13:52:39 +0000 |
| commit | 05b4f2ebc2f547d2413f738551f9933aae0d34dc (patch) | |
| tree | 7b004559cdfbdf094f7cd7a1f3f80df3aeefe338 /docs/ref | |
| parent | 950e05c3ff5daa360c3bddb84831d40b167062f1 (diff) | |
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
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 15 |
1 files changed, 6 insertions, 9 deletions
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 |
