Ticket #7113: changelist_custom_qs.diff
File changelist_custom_qs.diff, 1.1 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/views/main.py
121 121 self.opts = model._meta 122 122 self.lookup_opts = self.opts 123 123 self.root_query_set = model_admin.queryset(request) 124 self.root_query_set_class = type(self.root_query_set) 124 125 self.list_display = list_display 125 126 self.list_display_links = list_display_links 126 127 self.list_filter = list_filter … … 300 301 if self.search_fields and self.query: 301 302 for bit in self.query.split(): 302 303 or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.search_fields] 303 other_qs = QuerySet(self.model)304 other_qs = self.root_query_set_class(self.model) 304 305 other_qs.dup_select_related(qs) 305 306 other_qs = other_qs.filter(reduce(operator.or_, or_queries)) 306 307 qs = qs & other_qs