Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95dae6e

Browse files
authored
Merge pull request lionheart#129 from chris-nlnz/hotfix/issue-128-datatypes
Fix data_types incompatibility with Django 1.8+, issue lionheart#128.
2 parents 415cc50 + b5cae47 commit 95dae6e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

django_pyodbc/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
174174
# TODO: freetext, full-text contains...
175175
}
176176

177+
# In Django 1.8 data_types was moved from DatabaseCreation to DatabaseWrapper.
178+
# See https://docs.djangoproject.com/en/1.10/releases/1.8/#database-backend-api
179+
data_types = DatabaseCreation.data_types
180+
177181
def __init__(self, *args, **kwargs):
178182
super(DatabaseWrapper, self).__init__(*args, **kwargs)
179183

@@ -357,6 +361,7 @@ def _cursor(self):
357361
cursor.execute("SET DATEFORMAT ymd; SET DATEFIRST %s" % self.datefirst)
358362
if self.ops.sql_server_ver < 2005:
359363
self.creation.data_types['TextField'] = 'ntext'
364+
self.data_types['TextField'] = 'ntext'
360365
self.features.can_return_id_from_insert = False
361366

362367
ms_sqlncli = re.compile('^((LIB)?SQLN?CLI|LIBMSODBCSQL)')

0 commit comments

Comments
 (0)