Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2520 -- Fixed a problem with invalid SQL being generated by admin

interface in certain circumstances. Patch from favo@exoweb.net.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3794 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 96bc9ec79d12420a765ba210a9d8313c05b13d39 1 parent f88d582
@malcolmt malcolmt authored
Showing with 3 additions and 0 deletions.
  1. +1 −0  AUTHORS
  2. +2 −0  django/contrib/admin/views/main.py
View
1  AUTHORS
@@ -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
View
2  django/contrib/admin/views/main.py
@@ -727,6 +727,8 @@ def construct_search(field_name):
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
Please sign in to comment.
Something went wrong with that request. Please try again.