Skip to content

Commit 1f5ffa0

Browse files
committed
add DatabaseOperations.format_for_duration_arithmetic()
1 parent c769dcc commit 1f5ffa0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

django_mongodb/features.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ def django_test_expected_failures(self):
249249
# Func not implemented.
250250
"annotations.tests.NonAggregateAnnotationTestCase.test_custom_functions",
251251
"annotations.tests.NonAggregateAnnotationTestCase.test_custom_functions_can_ref_other_functions",
252-
# BaseDatabaseOperations may require a format_for_duration_arithmetic().
253-
"annotations.tests.NonAggregateAnnotationTestCase.test_mixed_type_annotation_date_interval",
254252
# FieldDoesNotExist with ordering.
255253
"annotations.tests.AliasTests.test_order_by_alias",
256254
"annotations.tests.NonAggregateAnnotationTestCase.test_order_by_aggregate",

django_mongodb/operations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,8 @@ def datetime_cast_date_sql(self, sql, params, tzname):
218218
def datetime_cast_time_sql(self, sql, params, tzname):
219219
return f"({sql})::time", params
220220

221+
def format_for_duration_arithmetic(self, sql):
222+
return "INTERVAL %s MILLISECOND" % sql
223+
221224
def time_trunc_sql(self, lookup_type, sql, params, tzname=None):
222225
return f"DATE_TRUNC(%s, {sql})::time", (lookup_type, *params)

0 commit comments

Comments
 (0)