From 8f410a577befddeff8639410a7a85d8e6d1c86e7 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 2 Feb 2009 13:43:18 +0000 Subject: Fixed #10127 -- Corrected handling of select_related() in annotate() calls. Thanks to Sylvain Pasche for the report and test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9805 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db/models/sql') 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'): -- cgit v1.3