mirror of https://github.com/django/django.git
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:
parent
f88d58285b
commit
96bc9ec79d
1
AUTHORS
1
AUTHORS
|
@ -72,6 +72,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Jeremy Dunck <http://dunck.us/>
|
Jeremy Dunck <http://dunck.us/>
|
||||||
Andy Dustman <farcepest@gmail.com>
|
Andy Dustman <farcepest@gmail.com>
|
||||||
Clint Ecker
|
Clint Ecker
|
||||||
|
favo@exoweb.net
|
||||||
gandalf@owca.info
|
gandalf@owca.info
|
||||||
Baishampayan Ghose
|
Baishampayan Ghose
|
||||||
martin.glueck@gmail.com
|
martin.glueck@gmail.com
|
||||||
|
|
|
@ -727,6 +727,8 @@ class ChangeList(object):
|
||||||
for bit in self.query.split():
|
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]
|
or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.lookup_opts.admin.search_fields]
|
||||||
other_qs = QuerySet(self.model)
|
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))
|
other_qs = other_qs.filter(reduce(operator.or_, or_queries))
|
||||||
qs = qs & other_qs
|
qs = qs & other_qs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue