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:
parent
60a77788be
commit
9831258985
@ -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]
|
||||
|
||||
@ -1227,4 +1225,4 @@ class TabularInline(InlineModelAdmin):
|
||||
template = 'admin/edit_inline/tabular.html'
|
||||
|
||||
class SelectorInline(InlineModelAdmin):
|
||||
template = 'admin/edit_inline/selector.html'
|
||||
template = 'admin/edit_inline/selector.html'
|
||||
|
Loading…
x
Reference in New Issue
Block a user