aboutsummaryrefslogtreecommitdiff
path: root/tagging/models.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 11:51:49 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 11:51:49 -0700
commit29425a36c920e9b54e5860429ef3e3ce639fb155 (patch)
treeedea6a643fec30f40ca1a05be55ae401fcc344de /tagging/models.py
parent99fde585a39d7867d2c2257b74a7cc441bc9f2a5 (diff)
downloadpython-django-tagging-29425a36c920e9b54e5860429ef3e3ce639fb155.tar
python-django-tagging-29425a36c920e9b54e5860429ef3e3ce639fb155.tar.gz
Imported Upstream version 0.3.1upstream/0.3.1
Diffstat (limited to 'tagging/models.py')
-rw-r--r--tagging/models.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tagging/models.py b/tagging/models.py
index d43f22d..860cf81 100644
--- a/tagging/models.py
+++ b/tagging/models.py
@@ -162,8 +162,18 @@ class TagManager(models.Manager):
Passing a value for ``min_count`` implies ``counts=True``.
"""
- extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:])
- where, params = queryset.query.where.as_sql()
+ if getattr(queryset.query, 'get_compiler', None):
+ # Django 1.2+
+ compiler = queryset.query.get_compiler(using='default')
+ extra_joins = ' '.join(compiler.get_from_clause()[0][1:])
+ where, params = queryset.query.where.as_sql(
+ compiler.quote_name_unless_alias, compiler.connection
+ )
+ else:
+ # Django pre-1.2
+ extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:])
+ where, params = queryset.query.where.as_sql()
+
if where:
extra_criteria = 'AND %s' % where
else: