summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2025-04-04 10:18:27 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-04-05 21:38:06 +0200
commitcd1aa54f5a1ad8673f8852aa3b0022c06b154b79 (patch)
tree804f45f32260984c46c2c1809bc8543589dc9aca /django/db/models/sql/query.py
parentd9bf0d07cc13c0351b65b025d7e8063864086975 (diff)
[5.2.x] Fixed #36299 -- Prevented field selection on QuerySet.alias() after values().
Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a. Refs #28900. Thanks Jeff Iadarola for the report and tests. Co-Authored-By: OutOfFocus4 <jeff.iadarola@gmail.com> Backport of 12b771a1ec4bbfe82405176f5601e6441855a303 from main
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 9fde8496e9..4d31c36175 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1221,7 +1221,7 @@ class Query(BaseExpression):
else:
self.set_annotation_mask(set(self.annotation_select).difference({alias}))
self.annotations[alias] = annotation
- if self.selected:
+ if select and self.selected:
self.selected[alias] = alias
@property