Commits

Mikhail Denisenko committed 63ccdc0

support for USE_TZ=True mode

  • Participants
  • Parent commits 15ee71d

Comments (0)

Files changed (3)

django_pytds/__init__.py

 # following PEP 386
-__version__ = "1.4"
+__version__ = "1.5"
 
 import patches

django_pytds/base.py

 import sys
 
 from django.db import utils
+from django.conf import settings
 from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, BaseDatabaseValidation, BaseDatabaseClient
 from django.db.backends.signals import connection_created
+try:
+    from django.utils.timezone import utc
+except:
+    pass
 
 import pytds as Database
 
 
         try:
             self.command_timeout = int(self.settings_dict.get('COMMAND_TIMEOUT', 30))
-        except ValueError:   
+        except ValueError:
             self.command_timeout = 30
         
         try:
                 autocommit=self.autocommit,
                 use_mars=options.get('use_mars', False),
                 load_balancer=options.get('load_balancer', None),
+                use_tz=utc if settings.USE_TZ else None,
             )
             # The OUTPUT clause is supported in 2005+ sql servers
             self.features.can_return_id_from_insert = self.connection.tds_version >= Database.TDS72
         'Topic :: Internet :: WWW/HTTP',
     ],
     zip_safe=True,
-    install_requires=['python-tds>=1.1.0'],
+    install_requires=['python-tds>=1.3.0'],
 )