Ticket #7795: trunk_wrong-queryset.patch
File trunk_wrong-queryset.patch, 1.1 KB (added by , 16 years ago) |
---|
-
contrib/admin/views/main.py
8 8 from django.core.paginator import Paginator, InvalidPage 9 9 from django.shortcuts import get_object_or_404, render_to_response 10 10 from django.db import models 11 from django.db.models.query import QuerySet12 11 from django.http import Http404, HttpResponse, HttpResponseRedirect 13 12 from django.utils.html import escape 14 13 from django.utils.text import capfirst, get_text_list … … 734 733 if self.lookup_opts.admin.search_fields and self.query: 735 734 for bit in self.query.split(): 736 735 or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.lookup_opts.admin.search_fields] 737 other_qs = QuerySet(self.model)736 other_qs = self.manager.get_query_set() 738 737 other_qs.dup_select_related(qs) 739 738 other_qs = other_qs.filter(reduce(operator.or_, or_queries)) 740 739 qs = qs & other_qs