File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -94,14 +94,12 @@ class DatabaseFeatures(BaseDatabaseFeatures):
94
94
"lookup.tests.LookupTests.test_lookup_collision" ,
95
95
"expressions.test_queryset_values.ValuesExpressionsTests.test_values_list_expression" ,
96
96
"expressions.test_queryset_values.ValuesExpressionsTests.test_values_list_expression_flat" ,
97
+ "expressions.tests.IterableLookupInnerExpressionsTests.test_expressions_in_lookups_join_choice" ,
97
98
"expressions_case.tests.CaseExpressionTests.test_join_promotion" ,
98
99
"expressions_case.tests.CaseExpressionTests.test_join_promotion_multiple_annotations" ,
99
100
"ordering.tests.OrderingTests.test_order_by_grandparent_fk_with_expression_in_default_ordering" ,
100
101
"ordering.tests.OrderingTests.test_order_by_parent_fk_with_expression_in_default_ordering" ,
101
102
"ordering.tests.OrderingTests.test_order_by_ptr_field_with_default_ordering_by_expression" ,
102
- # 'Col' object has no attribute 'utcoffset'
103
- "expressions.tests.IterableLookupInnerExpressionsTests.test_expressions_in_lookups_join_choice" ,
104
- "expressions.tests.IterableLookupInnerExpressionsTests.test_in_lookup_allows_F_expressions_and_expressions_for_datetimes" ,
105
103
# pymongo.errors.OperationFailure: $multiply only supports numeric
106
104
# types, not date. (should be wrapped in DatabaseError).
107
105
"expressions.tests.FTimeDeltaTests.test_invalid_operator" ,
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ def adapt_datefield_value(self, value):
36
36
def adapt_datetimefield_value (self , value ):
37
37
if value is None :
38
38
return None
39
+ # Expression values are adapted by the database.
40
+ if hasattr (value , "resolve_expression" ):
41
+ return value
39
42
if timezone .is_aware (value ):
40
43
if settings .USE_TZ :
41
44
value = timezone .make_naive (value , self .connection .timezone )
@@ -64,6 +67,9 @@ def adapt_timefield_value(self, value):
64
67
"""Store TimeField as datetime."""
65
68
if value is None :
66
69
return None
70
+ # Expression values are adapted by the database.
71
+ if hasattr (value , "resolve_expression" ):
72
+ return value
67
73
if timezone .is_aware (value ):
68
74
raise ValueError ("MongoDB backend does not support timezone-aware times." )
69
75
return datetime .datetime .combine (datetime .datetime .min .date (), value )
You can’t perform that action at this time.
0 commit comments