diff options
author | lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4> | 2011-06-06 17:36:31 +0000 |
---|---|---|
committer | lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4> | 2011-06-06 17:36:31 +0000 |
commit | 69fe1942edd09f377b930f9f44e1413e9f75cbab (patch) | |
tree | a3359abf520f8378733e038e7a2967de08ffc3ff | |
parent | 27d67396f5d7eb1411054b2153c44fc4aec75178 (diff) |
frontend/tko/models.py: Fix calls to as_sql method
In Django 1.3, Query objects do not possess the as_sql method.
Let's fix that, by calling as_sql on the SQLCompiler class.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@5407 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r-- | frontend/tko/models.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/frontend/tko/models.py b/frontend/tko/models.py index 483eb135..9b0d408f 100644 --- a/frontend/tko/models.py +++ b/frontend/tko/models.py @@ -24,7 +24,9 @@ class TempManager(model_logic.ExtendedManager): def _get_group_query_sql(self, query, group_by): - sql, params = query.query.as_sql() + compiler = query.query.get_compiler(using=query.db) + sql, params = compiler.as_sql() + # insert GROUP BY clause into query group_fields = self._get_field_names(group_by, query.query.extra_select) @@ -79,7 +81,8 @@ class TempManager(model_logic.ExtendedManager): group_fields = self._get_field_names(group_by, query.query.extra_select) query = query.order_by() # this can mess up the query and isn't needed - sql, params = query.query.as_sql() + compiler = query.query.get_compiler(using=query.db) + sql, params = compiler.as_sql() from_ = sql[sql.find(' FROM'):] return ('SELECT DISTINCT %s %s' % (','.join(group_fields), from_), |