mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +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:
parent
60a77788be
commit
9831258985
@ -741,12 +741,10 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
|
|
||||||
for bit in query.split():
|
for bit in query.split():
|
||||||
or_queries = [models.Q(**{construct_search(
|
or_queries = [models.Q(**{construct_search(
|
||||||
smart_str(field_name)): smart_str(bit)})
|
smart_str(field_name)): bit})
|
||||||
for field_name in search_fields]
|
for field_name in search_fields]
|
||||||
other_qs = QuerySet(rel_model)
|
|
||||||
other_qs.dup_select_related(queryset)
|
queryset = queryset.filter(reduce(operator.or_, or_queries))
|
||||||
other_qs = other_qs.filter(reduce(operator.or_, or_queries))
|
|
||||||
queryset = queryset & other_qs
|
|
||||||
|
|
||||||
data = [{"id": f.pk, "name": unicode(f)} for f in queryset]
|
data = [{"id": f.pk, "name": unicode(f)} for f in queryset]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user