Ticket #7795: newforms-admin_wrong-queryset.patch

File newforms-admin_wrong-queryset.patch, 1.0 KB (added by xek, 16 years ago)
  • django/contrib/admin/views/main.py

     
    33from django.contrib.admin.util import quote
    44from django.core.paginator import Paginator, InvalidPage
    55from django.db import models
    6 from django.db.models.query import QuerySet
    76from django.utils.encoding import force_unicode, smart_str
    87from django.utils.translation import ugettext
    98from django.utils.safestring import mark_safe
     
    216215        if self.search_fields and self.query:
    217216            for bit in self.query.split():
    218217                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()
    220219                other_qs.dup_select_related(qs)
    221220                other_qs = other_qs.filter(reduce(operator.or_, or_queries))
    222221                qs = qs & other_qs
Back to Top