diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-04-12 14:46:24 +0200 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-05-17 09:36:23 +0200 |
commit | ec186572e6cfde4cd4bc1491ff552c5d32211d9f (patch) | |
tree | 84bfb6b786f7dfecc535347a14284032bf0a5370 /django/db/backends/mysql/operations.py | |
parent | eda12ceef16aa1a98567e25be619b05a5b3c5757 (diff) | |
download | django-ec186572e6cfde4cd4bc1491ff552c5d32211d9f.tar.gz |
Removed global timezone-aware datetime converters.
Refs #23820.
Diffstat (limited to 'django/db/backends/mysql/operations.py')
-rw-r--r-- | django/db/backends/mysql/operations.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py index bc53f59ec5..3de35c7891 100644 --- a/django/db/backends/mysql/operations.py +++ b/django/db/backends/mysql/operations.py @@ -184,6 +184,8 @@ class DatabaseOperations(BaseDatabaseOperations): internal_type = expression.output_field.get_internal_type() if internal_type in ['BooleanField', 'NullBooleanField']: converters.append(self.convert_booleanfield_value) + if internal_type == 'DateTimeField': + converters.append(self.convert_datetimefield_value) if internal_type == 'UUIDField': converters.append(self.convert_uuidfield_value) if internal_type == 'TextField': @@ -195,6 +197,12 @@ class DatabaseOperations(BaseDatabaseOperations): value = bool(value) return value + def convert_datetimefield_value(self, value, expression, connection, context): + if value is not None: + if settings.USE_TZ: + value = value.replace(tzinfo=timezone.utc) + return value + def convert_uuidfield_value(self, value, expression, connection, context): if value is not None: value = uuid.UUID(value) |