Skip to content

Commit 833c64a

Browse files
committed
add DatabaseOperations.format_for_duration_arithmetic()
1 parent d545cd8 commit 833c64a

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
@@ -255,8 +255,6 @@ def django_test_expected_failures(self):
255255
# Func not implemented.
256256
"annotations.tests.NonAggregateAnnotationTestCase.test_custom_functions",
257257
"annotations.tests.NonAggregateAnnotationTestCase.test_custom_functions_can_ref_other_functions",
258-
# BaseDatabaseOperations may require a format_for_duration_arithmetic().
259-
"annotations.tests.NonAggregateAnnotationTestCase.test_mixed_type_annotation_date_interval",
260258
# FieldDoesNotExist with ordering.
261259
"annotations.tests.AliasTests.test_order_by_alias",
262260
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_with_m2m",

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)