Skip to content

Commit 4164076

Browse files
sir-sigurdtimgraham
authored andcommitted
Simplified generation of result in Query.get_aggregation().
1 parent 8a99a7d commit 4164076

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

django/db/models/sql/query.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,12 @@ def get_aggregation(self, using, added_aggregate_names):
461461
compiler = outer_query.get_compiler(using)
462462
result = compiler.execute_sql(SINGLE)
463463
if result is None:
464-
result = [None for q in outer_query.annotation_select.items()]
464+
result = [None] * len(outer_query.annotation_select)
465465

466466
converters = compiler.get_converters(outer_query.annotation_select.values())
467467
result = next(compiler.apply_converters((result,), converters))
468468

469-
return {
470-
alias: val
471-
for (alias, annotation), val
472-
in zip(outer_query.annotation_select.items(), result)
473-
}
469+
return dict(zip(outer_query.annotation_select, result))
474470

475471
def get_count(self, using):
476472
"""

0 commit comments

Comments
 (0)