diff options
| author | Simon Charette <charette.s@gmail.com> | 2013-10-07 13:38:15 -0400 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2013-10-07 13:45:52 -0400 |
| commit | a8df8e34f9fc0219de73eabcb215d976e75a89ae (patch) | |
| tree | b6dc0b69f02f3eda4529637b3e2dcb6208a648b3 /django | |
| parent | 259a6ea82cfb8bf242449666e4b643a19e54a423 (diff) | |
Revert "Fixed #21241 -- Avoid extraneous JOINs in admin changelist search."
This reverts commit 698dd82eee1cb83f51d4cd39546461bf76976b5e.
The patch introduced a backward incompatible change.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/options.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index f366b5d9bb..3b02ac020c 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -849,14 +849,10 @@ class ModelAdmin(BaseModelAdmin): if search_fields and search_term: orm_lookups = [construct_search(str(search_field)) for search_field in search_fields] - - query_parts = [] for bit in search_term.split(): - or_queries = (models.Q(**{orm_lookup: bit}) - for orm_lookup in orm_lookups) - query_parts.append(reduce(operator.or_, or_queries)) - queryset = queryset.filter(reduce(operator.and_, query_parts)) - + or_queries = [models.Q(**{orm_lookup: bit}) + for orm_lookup in orm_lookups] + queryset = queryset.filter(reduce(operator.or_, or_queries)) if not use_distinct: for search_spec in orm_lookups: if lookup_needs_distinct(self.opts, search_spec): |
