From bd6d9ea87cfa252c2992904897e137bc23da56c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Thu, 25 Oct 2012 19:13:10 +0300 Subject: [PATCH] Fixed regression caused by #19102 --- django/db/models/sql/query.py | 4 +++- django/db/models/sql/subqueries.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 264e29eaf3..cef01c48ab 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -115,7 +115,6 @@ class Query(object): self.default_ordering = True self.standard_ordering = True self.ordering_aliases = [] - self.select_fields = [] self.related_select_fields = [] self.dupe_avoidance = {} self.used_aliases = set() @@ -124,6 +123,9 @@ class Query(object): # SQL-related attributes self.select = [] + # For each to-be-selected field in self.select there must be a + # corresponding entry in self.select - git seems to need this. + self.select_fields = [] self.tables = [] # Aliases in the order they are created. self.where = where() self.where_class = where diff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py index 7bed88c005..24ac957cbf 100644 --- a/django/db/models/sql/subqueries.py +++ b/django/db/models/sql/subqueries.py @@ -76,7 +76,7 @@ class DeleteQuery(Query): return else: innerq.clear_select_clause() - innerq.select = [(self.get_initial_alias(), pk.column)] + innerq.select, innerq.select_fields = [(self.get_initial_alias(), pk.column)], [None] values = innerq where = self.where_class() where.add((Constraint(None, pk.column, pk), 'in', values), AND) @@ -244,7 +244,7 @@ class DateQuery(Query): alias = result[3][-1] select = Date((alias, field.column), lookup_type) self.clear_select_clause() - self.select = [select] + self.select, self.select_fields = [select], [None] self.distinct = True self.order_by = order == 'ASC' and [1] or [-1]