1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Fixed #10064 -- Corrected handling of aggregate queries that also use select_related(). Thanks to olivius for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9781 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2009-01-20 12:23:48 +00:00
parent 728108883a
commit 39516803f1
2 changed files with 6 additions and 2 deletions

View File

@@ -250,11 +250,12 @@ class BaseQuery(object):
if self.aggregate_select:
aggregate_start = len(self.extra_select.keys()) + len(self.select)
aggregate_end = aggregate_start + len(self.aggregate_select)
row = tuple(row[:aggregate_start]) + tuple([
self.resolve_aggregate(value, aggregate)
for (alias, aggregate), value
in zip(self.aggregate_select.items(), row[aggregate_start:])
])
in zip(self.aggregate_select.items(), row[aggregate_start:aggregate_end])
]) + tuple(row[aggregate_end:])
yield row