summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorDevilsAutumn <bhuvnesh875@gmail.com>2022-09-06 15:22:41 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-09 08:37:46 +0200
commit32797e7fbfb28c4cd2210aae37157267d237364f (patch)
tree6397ada184e2e721e72354f1a93a35d1eeee1484 /django/db/models/sql/query.py
parent0c3981eb5094419fe200eb46c71b5376a2266166 (diff)
downloaddjango-32797e7fbfb28c4cd2210aae37157267d237364f.tar.gz
Fixed #33975 -- Fixed __in lookup when rhs is a queryset with annotate() and alias().
This fixes clearing selected fields.
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 8419dc0d54..5dca423de4 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -198,6 +198,7 @@ class Query(BaseExpression):
select_for_update_of = ()
select_for_no_key_update = False
select_related = False
+ has_select_fields = False
# Arbitrary limit for select_related to prevents infinite recursion.
max_depth = 5
# Holds the selects defined by a call to values() or values_list()
@@ -263,12 +264,6 @@ class Query(BaseExpression):
elif len(self.annotation_select) == 1:
return next(iter(self.annotation_select.values())).output_field
- @property
- def has_select_fields(self):
- return bool(
- self.select or self.annotation_select_mask or self.extra_select_mask
- )
-
@cached_property
def base_table(self):
for alias in self.alias_map:
@@ -2384,6 +2379,7 @@ class Query(BaseExpression):
self.select_related = False
self.clear_deferred_loading()
self.clear_select_fields()
+ self.has_select_fields = True
if fields:
field_names = []