mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
Fixed #6957 -- Removed a stray reference to QuerySet._select_related and added
a way to copy the select_related() settings from an existing queryset. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7425 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
81b3043827
commit
c934beea01
@ -750,8 +750,7 @@ class ChangeList(object):
|
||||
for bit in self.query.split():
|
||||
or_queries = [models.Q(**{construct_search(field_name): bit}) for field_name in self.lookup_opts.admin.search_fields]
|
||||
other_qs = QuerySet(self.model)
|
||||
if qs._select_related:
|
||||
other_qs = other_qs.select_related()
|
||||
other_qs.dup_select_related(qs)
|
||||
other_qs = other_qs.filter(reduce(operator.or_, or_queries))
|
||||
qs = qs & other_qs
|
||||
|
||||
|
@ -402,6 +402,13 @@ class _QuerySet(object):
|
||||
obj.query.max_depth = depth
|
||||
return obj
|
||||
|
||||
def dup_select_related(self, other):
|
||||
"""
|
||||
Copies the related selection status from the queryset 'other' to the
|
||||
current queryset.
|
||||
"""
|
||||
self.query.select_related = other.query.select_related
|
||||
|
||||
def order_by(self, *field_names):
|
||||
"""Returns a new QuerySet instance with the ordering changed."""
|
||||
assert self.query.can_filter(), \
|
||||
|
Loading…
x
Reference in New Issue
Block a user