Ticket #2520: django_admin_change_list_order_bug.diff

File django_admin_change_list_order_bug.diff, 681 bytes (added by favo@…, 9 years ago)

Fixed #2520.

  • django/contrib/admin/views/main.py

     
    715715            for bit in self.query.split():
    716716                or_queries = [models.Q(**{'%s__icontains' % field_name: bit}) for field_name in self.lookup_opts.admin.search_fields]
    717717                other_qs = QuerySet(self.model)
     718                if qs._select_related:
     719                    other_qs = other_qs.select_related()
    718720                other_qs = other_qs.filter(reduce(operator.or_, or_queries))
    719721                qs = qs & other_qs
    720722
Back to Top