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
This commit is contained in:
Malcolm Tredinnick 2006-09-22 13:10:46 +00:00
parent f88d58285b
commit 96bc9ec79d
2 changed files with 3 additions and 0 deletions

View File

@ -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 File

@ -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