summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-06-21 01:25:22 -0400
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-06-25 14:02:20 +0200
commit2a7497b0362f29db14af619a4b9c33e8e7a664a7 (patch)
tree1ac89f218e2a007e976bb13ecf86f3158540e8a2 /django/db/models/sql/query.py
parentd9bd58c3b8b3e8735d8242c2bb9b09c52ed6171b (diff)
Used Query.add_annotation where appropriate.
This avoids manual .annotations and .append_annotation_mask manipulations.
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index a7bc0610c8..07c3fdbd34 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -565,8 +565,7 @@ class Query(BaseExpression):
col_alias = f"__col{index}"
col_ref = Ref(col_alias, col)
col_refs[col] = col_ref
- inner_query.annotations[col_alias] = col
- inner_query.append_annotation_mask([col_alias])
+ inner_query.add_annotation(col, col_alias)
replacements[col] = col_ref
outer_query.annotations[alias] = aggregate.replace_expressions(
replacements