Simplified generation of result in Query.get_aggregation().

This commit is contained in:
Sergey Fedoseev 2017-08-15 18:59:31 +05:00 committed by Tim Graham
parent 8a99a7d2d5
commit 41640760df
1 changed files with 2 additions and 6 deletions

View File

@ -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):
"""