Skip to content

Commit

Permalink
Fixed #2520 -- Fixed a problem with invalid SQL being generated by admin
Browse files Browse the repository at this point in the history
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
malcolmt committed Sep 22, 2006
1 parent f88d582 commit 96bc9ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions django/contrib/admin/views/main.py
Expand Up @@ -727,6 +727,8 @@ def construct_search(field_name):
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


Expand Down

0 comments on commit 96bc9ec

Please sign in to comment.