aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaƫl Hertzog <hertzog@debian.org>2015-10-08 11:51:55 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 11:51:55 -0700
commit210bfd7f97afe0162e682cbd2530115cf09fd51d (patch)
tree9b24ede65040b0f1bafd8f9416c9e08960a64b00
parentf50f19a1d9495ca98bf0e5de941ab9c21bcdbf91 (diff)
downloadpython-django-tagging-210bfd7f97afe0162e682cbd2530115cf09fd51d.tar
python-django-tagging-210bfd7f97afe0162e682cbd2530115cf09fd51d.tar.gz
Add django 1.7 compatibility
Bug-Debian: http://bugs.debian.org/755624 Origin: vendor Last-Update: 2014-08-06 Patch-Name: django-1.7-compat.patch
-rw-r--r--tagging/models.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tagging/models.py b/tagging/models.py
index 860cf81..e13b077 100644
--- a/tagging/models.py
+++ b/tagging/models.py
@@ -17,6 +17,8 @@ from tagging import settings
from tagging.utils import calculate_cloud, get_tag_list, get_queryset_and_model, parse_tag_input
from tagging.utils import LOGARITHMIC
+import collections
+
qn = connection.ops.quote_name
############
@@ -166,9 +168,16 @@ class TagManager(models.Manager):
# 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
- )
+ if isinstance(compiler, collections.Callable):
+ # Django 1.7+
+ where, params = queryset.query.where.as_sql(
+ compiler, compiler.connection
+ )
+ else:
+ # Django 1.2-1.6
+ 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:])