diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-02-02 13:43:18 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-02-02 13:43:18 +0000 |
| commit | 8f410a577befddeff8639410a7a85d8e6d1c86e7 (patch) | |
| tree | fa1e8febe2a2219453d78b34b2629cd055fd4ad1 /django/db | |
| parent | 65ad2132abd4c56f38c43b0ba9a23ed716733728 (diff) | |
Fixed #10127 -- Corrected handling of select_related() in annotate() calls. Thanks to Sylvain Pasche <sylvain.pasche@gmail.com> for the report and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9805 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/models/query.py | 4 | ||||
| -rw-r--r-- | django/db/models/sql/query.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index 04a1c513f6..aa2034919c 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -280,8 +280,8 @@ class QuerySet(object): for row in self.query.results_iter(): if fill_cache: - obj, aggregate_start = get_cached_row(self.model, row, - index_start, max_depth, requested=requested) + obj, _ = get_cached_row(self.model, row, + index_start, max_depth, requested=requested) else: # omit aggregates in object creation obj = self.model(*row[index_start:aggregate_start]) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 4e46da6424..bf664c606e 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -698,7 +698,7 @@ class BaseQuery(object): """ qn = self.quote_name_unless_alias result = [] - for col in self.group_by: + for col in self.group_by + self.related_select_cols: if isinstance(col, (list, tuple)): result.append('%s.%s' % (qn(col[0]), qn(col[1]))) elif hasattr(col, 'as_sql'): |
