Skip to content

Commit

Permalink
fix issue avidal#8
Browse files Browse the repository at this point in the history
  • Loading branch information
michiya committed Jun 7, 2013
1 parent bce251f commit cc22e8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
18 changes: 9 additions & 9 deletions django_pyodbc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@
from django.db.backends.signals import connection_created
from django.conf import settings
from django import VERSION as DjangoVersion
if DjangoVersion[:2] == (1,2):
from django import get_version
version_str = get_version()
if 'SVN' in version_str and int(version_str.split('SVN-')[-1]) < 11952: # django trunk revision 11952 Added multiple database support.
_DJANGO_VERSION = 11
else:
_DJANGO_VERSION = 12
if DjangoVersion[:2] >= (1,5):
_DJANGO_VERSION = 15
elif DjangoVersion[:2] == (1,4):
_DJANGO_VERSION = 14
elif DjangoVersion[:2] == (1,3):
_DJANGO_VERSION = 13
elif DjangoVersion[:2] == (1,2):
_DJANGO_VERSION = 12
elif DjangoVersion[:2] == (1,1):
_DJANGO_VERSION = 11
elif DjangoVersion[:2] == (1,0):
_DJANGO_VERSION = 10
elif DjangoVersion[0] == 1:
_DJANGO_VERSION = 13
else:
_DJANGO_VERSION = 9

Expand Down Expand Up @@ -85,6 +84,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):


class DatabaseWrapper(BaseDatabaseWrapper):
_DJANGO_VERSION = _DJANGO_VERSION
drv_name = None
driver_needs_utf8 = None
MARS_Connection = False
Expand Down
5 changes: 4 additions & 1 deletion django_pyodbc/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ def _as_sql(self, strategy):
result.append('WHERE %s' % where)
params.extend(w_params)

grouping, gb_params = self.get_grouping(ordering_group_by)
if self.connection._DJANGO_VERSION >= 15:
grouping, gb_params = self.get_grouping(ordering_group_by)
else:
grouping, gb_params = self.get_grouping()
if grouping:
if ordering:
# If the backend can't group by PK (i.e., any database
Expand Down

0 comments on commit cc22e8d

Please sign in to comment.