1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

[soc2009/admin-ui] simplify the autocomplete view.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/admin-ui@11797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Florian Apolloner 2009-12-05 19:05:04 +00:00
parent 60a77788be
commit 9831258985

View File

@ -741,12 +741,10 @@ class ModelAdmin(BaseModelAdmin):
for bit in query.split():
or_queries = [models.Q(**{construct_search(
smart_str(field_name)): smart_str(bit)})
smart_str(field_name)): bit})
for field_name in search_fields]
other_qs = QuerySet(rel_model)
other_qs.dup_select_related(queryset)
other_qs = other_qs.filter(reduce(operator.or_, or_queries))
queryset = queryset & other_qs
queryset = queryset.filter(reduce(operator.or_, or_queries))
data = [{"id": f.pk, "name": unicode(f)} for f in queryset]