diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-04-28 15:45:36 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-04-28 15:45:36 +0000 |
| commit | 4938c8ea6db6f23ebb0883b8a092985344508b25 (patch) | |
| tree | af634ef3c8ba1e7cbae1f33e1e713f6c47bbd2d7 | |
| parent | e8b2a8649fe73b8076574efa43e4e31a45d40406 (diff) | |
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
| -rw-r--r-- | django/contrib/admin/views/main.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 222452d13e..e2011f04c5 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -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) |
