mirror of
https://github.com/django/django.git
synced 2025-06-27 14:29:19 +00:00
Reduced nesting inside Query.get_aggregation().
This commit is contained in:
parent
10037130c1
commit
1771998c09
@ -514,14 +514,13 @@ class Query(BaseExpression):
|
|||||||
# and move them to the outer AggregateQuery.
|
# and move them to the outer AggregateQuery.
|
||||||
col_cnt = 0
|
col_cnt = 0
|
||||||
for alias, expression in list(inner_query.annotation_select.items()):
|
for alias, expression in list(inner_query.annotation_select.items()):
|
||||||
|
if not expression.is_summary:
|
||||||
|
continue
|
||||||
annotation_select_mask = inner_query.annotation_select_mask
|
annotation_select_mask = inner_query.annotation_select_mask
|
||||||
if expression.is_summary:
|
expression, col_cnt = inner_query.rewrite_cols(expression, col_cnt)
|
||||||
expression, col_cnt = inner_query.rewrite_cols(expression, col_cnt)
|
outer_query.annotations[alias] = expression.relabeled_clone(relabels)
|
||||||
outer_query.annotations[alias] = expression.relabeled_clone(
|
del inner_query.annotations[alias]
|
||||||
relabels
|
annotation_select_mask.remove(alias)
|
||||||
)
|
|
||||||
del inner_query.annotations[alias]
|
|
||||||
annotation_select_mask.remove(alias)
|
|
||||||
# Make sure the annotation_select wont use cached results.
|
# Make sure the annotation_select wont use cached results.
|
||||||
inner_query.set_annotation_mask(inner_query.annotation_select_mask)
|
inner_query.set_annotation_mask(inner_query.annotation_select_mask)
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user