Commits

Ian George committed 11c5916
  • Participants
  • Parent commits d808714

Comments (0)

Files changed (2)

tagging/models.py

         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 and up compatible (multiple databases)
+            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 1.1 and down compatible (single database)
+            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:

tagging/models.pyc

Binary file modified.