From 41640760dfb2f0fddd2598ab7078e037578fc14b Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Tue, 15 Aug 2017 18:59:31 +0500 Subject: [PATCH] Simplified generation of result in Query.get_aggregation(). --- django/db/models/sql/query.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index b17a33393e..9492e5bd58 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -461,16 +461,12 @@ class Query: compiler = outer_query.get_compiler(using) result = compiler.execute_sql(SINGLE) if result is None: - result = [None for q in outer_query.annotation_select.items()] + result = [None] * len(outer_query.annotation_select) converters = compiler.get_converters(outer_query.annotation_select.values()) result = next(compiler.apply_converters((result,), converters)) - return { - alias: val - for (alias, annotation), val - in zip(outer_query.annotation_select.items(), result) - } + return dict(zip(outer_query.annotation_select, result)) def get_count(self, using): """