aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/django-1.7-compat.patch
blob: 4e50ffe0da66b0f72f558f5715c5f860e5f5e12c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: Add django 1.7 compatibility
Author: Raphaël Hertzog <hertzog@debian.org>
Bug-Debian: http://bugs.debian.org/755624
Origin: vendor
Last-Update: 2014-08-06

--- python-django-tagging-0.3.1.orig/tagging/models.py
+++ python-django-tagging-0.3.1/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:])