Improved performance of loading DateTimeField on Oracle and MySQL.

This commit is contained in:
Sergey Fedoseev 2017-12-08 19:53:27 +05:00 committed by Tim Graham
parent 23a27f2c03
commit c5a2f48bed
2 changed files with 6 additions and 6 deletions

View File

@ -219,7 +219,8 @@ class DatabaseOperations(BaseDatabaseOperations):
elif internal_type in ['BooleanField', 'NullBooleanField']:
converters.append(self.convert_booleanfield_value)
elif internal_type == 'DateTimeField':
converters.append(self.convert_datetimefield_value)
if settings.USE_TZ:
converters.append(self.convert_datetimefield_value)
elif internal_type == 'UUIDField':
converters.append(self.convert_uuidfield_value)
return converters
@ -236,8 +237,7 @@ class DatabaseOperations(BaseDatabaseOperations):
def convert_datetimefield_value(self, value, expression, connection):
if value is not None:
if settings.USE_TZ:
value = timezone.make_aware(value, self.connection.timezone)
value = timezone.make_aware(value, self.connection.timezone)
return value
def convert_uuidfield_value(self, value, expression, connection):

View File

@ -153,7 +153,8 @@ END;
elif internal_type in ['BooleanField', 'NullBooleanField']:
converters.append(self.convert_booleanfield_value)
elif internal_type == 'DateTimeField':
converters.append(self.convert_datetimefield_value)
if settings.USE_TZ:
converters.append(self.convert_datetimefield_value)
elif internal_type == 'DateField':
converters.append(self.convert_datefield_value)
elif internal_type == 'TimeField':
@ -192,8 +193,7 @@ END;
def convert_datetimefield_value(self, value, expression, connection):
if value is not None:
if settings.USE_TZ:
value = timezone.make_aware(value, self.connection.timezone)
value = timezone.make_aware(value, self.connection.timezone)
return value
def convert_datefield_value(self, value, expression, connection):