Ticket #7795: newforms-admin_wrong-queryset.patch
File newforms-admin_wrong-queryset.patch, 1.0 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/views/main.py
3 3 from django.contrib.admin.util import quote 4 4 from django.core.paginator import Paginator, InvalidPage 5 5 from django.db import models 6 from django.db.models.query import QuerySet7 6 from django.utils.encoding import force_unicode, smart_str 8 7 from django.utils.translation import ugettext 9 8 from django.utils.safestring import mark_safe … … 216 215 if self.search_fields and self.query: 217 216 for bit in self.query.split(): 218 217 or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.search_fields] 219 other_qs = QuerySet(self.model)218 other_qs = self.manager.get_query_set() 220 219 other_qs.dup_select_related(qs) 221 220 other_qs = other_qs.filter(reduce(operator.or_, or_queries)) 222 221 qs = qs & other_qs