diff options
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/contrib/admin/views/main.py | 2 |
2 files changed, 3 insertions, 0 deletions
@@ -72,6 +72,7 @@ answer newbie questions, and generally made Django that much better: Jeremy Dunck <http://dunck.us/> Andy Dustman <farcepest@gmail.com> Clint Ecker + favo@exoweb.net gandalf@owca.info Baishampayan Ghose martin.glueck@gmail.com diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 7c942ca5b8..38d64bd73b 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -727,6 +727,8 @@ class ChangeList(object): for bit in self.query.split(): or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.lookup_opts.admin.search_fields] other_qs = QuerySet(self.model) + if qs._select_related: + other_qs = other_qs.select_related() other_qs = other_qs.filter(reduce(operator.or_, or_queries)) qs = qs & other_qs |
