From 33aa18a6e3c831930bda0028222a26f9c1d96e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Sat, 11 Jan 2014 14:57:12 +0200 Subject: [PATCH] Renamed get_cols to get_group_by_cols --- django/db/models/lookups.py | 12 ++++++------ django/db/models/sql/aggregates.py | 2 +- django/db/models/sql/compiler.py | 2 +- django/db/models/sql/datastructures.py | 2 +- django/db/models/sql/expressions.py | 6 +++--- django/db/models/sql/where.py | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py index 1e5a872d9c..038e7e481e 100644 --- a/django/db/models/lookups.py +++ b/django/db/models/lookups.py @@ -54,8 +54,8 @@ class Extract(RegisterLookupMixin): def relabeled_clone(self, relabels): return self.__class__(self.lhs.relabeled_clone(relabels)) - def get_cols(self): - return self.lhs.get_cols() + def get_group_by_cols(self): + return self.lhs.get_group_by_cols() class Lookup(RegisterLookupMixin): @@ -102,10 +102,10 @@ class Lookup(RegisterLookupMixin): new.rhs = new.rhs.relabeled_clone(relabels) return new - def get_cols(self): - cols = self.lhs.get_cols() - if hasattr(self.rhs, 'get_cols'): - cols.extend(self.rhs.get_cols()) + def get_group_by_cols(self): + cols = self.lhs.get_group_by_cols() + if hasattr(self.rhs, 'get_group_by_cols'): + cols.extend(self.rhs.get_group_by_cols()) return cols def as_sql(self, qn, connection): diff --git a/django/db/models/sql/aggregates.py b/django/db/models/sql/aggregates.py index 445079b72e..aef8b493bb 100644 --- a/django/db/models/sql/aggregates.py +++ b/django/db/models/sql/aggregates.py @@ -94,7 +94,7 @@ class Aggregate(RegisterLookupMixin): return self.sql_template % substitutions, params - def get_cols(self): + def get_group_by_cols(self): return [] @property diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 90b32c1b1e..f2361c80e5 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -106,7 +106,7 @@ class SQLCompiler(object): where, w_params = self.compile(self.query.where) having, h_params = self.compile(self.query.having) - having_group_by = self.query.having.get_cols() + having_group_by = self.query.having.get_group_by_cols() params = [] for val in six.itervalues(self.query.extra_select): params.extend(val[1]) diff --git a/django/db/models/sql/datastructures.py b/django/db/models/sql/datastructures.py index 912e4ba5d2..58a6576504 100644 --- a/django/db/models/sql/datastructures.py +++ b/django/db/models/sql/datastructures.py @@ -22,7 +22,7 @@ class Col(object): def relabeled_clone(self, relabels): return self.__class__(relabels.get(self.alias, self.alias), self.target, self.source) - def get_cols(self): + def get_group_by_cols(self): return [(self.alias, self.target.column)] def get_lookup(self, name): diff --git a/django/db/models/sql/expressions.py b/django/db/models/sql/expressions.py index 9f29e2ace5..e31eaa8a2f 100644 --- a/django/db/models/sql/expressions.py +++ b/django/db/models/sql/expressions.py @@ -24,11 +24,11 @@ class SQLEvaluator(object): (change_map.get(col[0], col[0]), col[1]))) return clone - def get_cols(self): + def get_group_by_cols(self): cols = [] for node, col in self.cols: - if hasattr(node, 'get_cols'): - cols.extend(node.get_cols()) + if hasattr(node, 'get_group_by_cols'): + cols.extend(node.get_group_by_cols()) elif isinstance(col, tuple): cols.append(col) return cols diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 1b241a1942..be0c559c1b 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -153,16 +153,16 @@ class WhereNode(tree.Node): sql_string = '(%s)' % sql_string return sql_string, result_params - def get_cols(self): + def get_group_by_cols(self): cols = [] for child in self.children: - if hasattr(child, 'get_cols'): - cols.extend(child.get_cols()) + if hasattr(child, 'get_group_by_cols'): + cols.extend(child.get_group_by_cols()) else: if isinstance(child[0], Constraint): cols.append((child[0].alias, child[0].col)) - if hasattr(child[3], 'get_cols'): - cols.extend(child[3].get_cols()) + if hasattr(child[3], 'get_group_by_cols'): + cols.extend(child[3].get_group_by_cols()) return cols def make_atom(self, child, qn, connection):