summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/backends/__init__.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 4390b1ec04..5116f50668 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -883,16 +883,14 @@ class BaseDatabaseOperations(object):
Coerce the value returned by the database backend into a consistent type
that is compatible with the field type.
"""
- internal_type = field.get_internal_type()
- if internal_type == 'DecimalField':
+ if value is None:
return value
- elif internal_type == 'FloatField':
+ internal_type = field.get_internal_type()
+ if internal_type == 'FloatField':
return float(value)
elif (internal_type and (internal_type.endswith('IntegerField')
or internal_type == 'AutoField')):
return int(value)
- elif internal_type in ('DateField', 'DateTimeField', 'TimeField'):
- return value
return value
def check_aggregate_support(self, aggregate_func):