Skip to content

Commit 4381d32

Browse files
committed
remove integer/float converters
1 parent feb4712 commit 4381d32

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

django_mongodb/features.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
3535
# Order by constant not supported:
3636
# AttributeError: 'Field' object has no attribute 'model'
3737
"aggregation.tests.AggregateTestCase.test_annotate_values_list",
38-
"aggregation.tests.AggregateTestCase.test_combine_different_types",
3938
"aggregation.tests.AggregateTestCase.test_grouped_annotation_in_group_by",
4039
"aggregation.tests.AggregateTestCase.test_non_grouped_annotation_not_in_group_by",
4140
"aggregation.tests.AggregateTestCase.test_values_annotation_with_expression",
@@ -45,6 +44,9 @@ class DatabaseFeatures(BaseDatabaseFeatures):
4544
"ordering.tests.OrderingTests.test_order_by_constant_value",
4645
"expressions.tests.NegatedExpressionTests.test_filter",
4746
"expressions_case.tests.CaseExpressionTests.test_order_by_conditional_implicit",
47+
# BaseExpression.convert_value() crashes with Decimal128.
48+
"aggregation.tests.AggregateTestCase.test_combine_different_types",
49+
"annotations.tests.NonAggregateAnnotationTestCase.test_combined_f_expression_annotation_with_aggregation",
4850
# NotSupportedError: order_by() expression not supported.
4951
"aggregation.tests.AggregateTestCase.test_aggregation_order_by_not_selected_annotation_values",
5052
"db_functions.comparison.test_coalesce.CoalesceTests.test_ordering",

django_mongodb/operations.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ def get_db_converters(self, expression):
8282
elif internal_type == "DateTimeField":
8383
if settings.USE_TZ:
8484
converters.append(self.convert_datetimefield_value)
85-
elif internal_type == "FloatField":
86-
converters.append(self.convert_floatfield_value)
87-
elif internal_type.endswith("IntegerField"):
88-
converters.append(self.convert_integerfield_value)
8985
elif internal_type == "DecimalField":
9086
converters.append(self.convert_decimalfield_value)
9187
elif internal_type == "JSONField":
@@ -127,16 +123,6 @@ def convert_durationfield_value(self, value, expression, connection):
127123
value = datetime.timedelta(milliseconds=int(str(value)))
128124
return value
129125

130-
def convert_floatfield_value(self, value, expression, connection):
131-
if value is None:
132-
return value
133-
if isinstance(value, Decimal128):
134-
return float(value.to_decimal())
135-
return float(value)
136-
137-
def convert_integerfield_value(self, value, expression, connection):
138-
return None if value is None else int(value)
139-
140126
def convert_jsonfield_value(self, value, expression, connection):
141127
"""
142128
Convert dict data to a string so that JSONField.from_db_value() can

0 commit comments

Comments
 (0)