Fixed #24211 -- Removed ValuesQuerySet() and ValuesListQuerySet().

Thanks Anssi Kääriäinen, Marc Tamlyn, and Tim Graham for the reviews.
This commit is contained in:
Loic Bistuer 2015-01-30 14:26:13 +07:00
parent dbabf43920
commit 4c3bfe9053
10 changed files with 264 additions and 349 deletions

View file

@ -148,7 +148,14 @@ class Query(object):
self.distinct_fields = []
self.select_for_update = False
self.select_for_update_nowait = False
self.select_related = False
# Arbitrary limit for select_related to prevents infinite recursion.
self.max_depth = 5
# Holds the selects defined by a call to values() or values_list()
# excluding annotation_select and extra_select.
self.values_select = []
# SQL annotation-related attributes
# The _annotations will be an OrderedDict when used. Due to the cost
@ -158,10 +165,6 @@ class Query(object):
self.annotation_select_mask = None
self._annotation_select_cache = None
# Arbitrary maximum limit for select_related. Prevents infinite
# recursion. Can be changed by the depth parameter to select_related().
self.max_depth = 5
# These are for extensions. The contents are more or less appended
# verbatim to the appropriate clause.
# The _extra attribute is an OrderedDict, lazily created similarly to
@ -273,6 +276,7 @@ class Query(object):
obj.select_for_update = self.select_for_update
obj.select_for_update_nowait = self.select_for_update_nowait
obj.select_related = self.select_related
obj.values_select = self.values_select[:]
obj._annotations = self._annotations.copy() if self._annotations is not None else None
if self.annotation_select_mask is None:
obj.annotation_select_mask = None
@ -1616,6 +1620,7 @@ class Query(object):
columns.
"""
self.select = []
self.values_select = []
def add_select(self, col):
self.default_cols = False