equal
deleted
inserted
replaced
6 from django.db.models.query import QuerySet |
6 from django.db.models.query import QuerySet |
7 from django.utils.encoding import force_unicode, smart_str |
7 from django.utils.encoding import force_unicode, smart_str |
8 from django.utils.translation import ugettext |
8 from django.utils.translation import ugettext |
9 from django.utils.http import urlencode |
9 from django.utils.http import urlencode |
10 import operator |
10 import operator |
11 |
|
12 try: |
|
13 set |
|
14 except NameError: |
|
15 from sets import Set as set # Python 2.3 fallback |
|
16 |
11 |
17 # The system will display a "Show all" link on the change list only if the |
12 # The system will display a "Show all" link on the change list only if the |
18 # total result count is less than or equal to this setting. |
13 # total result count is less than or equal to this setting. |
19 MAX_SHOW_ALL_ALLOWED = 200 |
14 MAX_SHOW_ALL_ALLOWED = 200 |
20 |
15 |
183 |
178 |
184 # if key ends with __in, split parameter into separate values |
179 # if key ends with __in, split parameter into separate values |
185 if key.endswith('__in'): |
180 if key.endswith('__in'): |
186 lookup_params[key] = value.split(',') |
181 lookup_params[key] = value.split(',') |
187 |
182 |
|
183 # if key ends with __isnull, special case '' and false |
|
184 if key.endswith('__isnull'): |
|
185 if value.lower() in ('', 'false'): |
|
186 lookup_params[key] = False |
|
187 else: |
|
188 lookup_params[key] = True |
|
189 |
188 # Apply lookup parameters from the query string. |
190 # Apply lookup parameters from the query string. |
189 try: |
191 try: |
190 qs = qs.filter(**lookup_params) |
192 qs = qs.filter(**lookup_params) |
191 # Naked except! Because we don't have any other way of validating "params". |
193 # Naked except! Because we don't have any other way of validating "params". |
192 # They might be invalid if the keyword arguments are incorrect, or if the |
194 # They might be invalid if the keyword arguments are incorrect, or if the |