1
0
mirror of https://github.com/django/django.git synced 2025-07-03 17:29:12 +00:00

newforms-admin: Fixed #2818 -- Filtered out duplicate results when searching in

the admin across related fields. Thanks, Andy Dustman.


git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5123 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-04-28 15:45:36 +00:00
parent e8b2a8649f
commit 4938c8ea6d

View File

@ -436,6 +436,10 @@ class ChangeList(object):
other_qs = other_qs.select_related()
other_qs = other_qs.filter(reduce(operator.or_, or_queries))
qs = qs & other_qs
for field_name in self.search_fields:
if '__' in field_name:
qs = qs.distinct()
break
if self.opts.one_to_one_field:
qs = qs.complex_filter(self.opts.one_to_one_field.rel.limit_choices_to)