Ticket #7795: trunk_wrong-queryset.patch

File trunk_wrong-queryset.patch, 1.1 KB (added by xek, 16 years ago)
  • contrib/admin/views/main.py

     
    88from django.core.paginator import Paginator, InvalidPage
    99from django.shortcuts import get_object_or_404, render_to_response
    1010from django.db import models
    11 from django.db.models.query import QuerySet
    1211from django.http import Http404, HttpResponse, HttpResponseRedirect
    1312from django.utils.html import escape
    1413from django.utils.text import capfirst, get_text_list
     
    734733        if self.lookup_opts.admin.search_fields and self.query:
    735734            for bit in self.query.split():
    736735                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()
    738737                other_qs.dup_select_related(qs)
    739738                other_qs = other_qs.filter(reduce(operator.or_, or_queries))
    740739                qs = qs & other_qs
Back to Top