Skip to content

Commit 342d16d

Browse files
committed
fix QuerySet.annotate() crash with combined expression
1 parent b68b13f commit 342d16d

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

django_mongodb/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _make_result(self, entity, columns):
8383
if column_alias is not None and column_alias != self.collection_name
8484
else entity
8585
)
86-
result.append(obj.get(name, col.field.get_default()))
86+
result.append(obj.get(name))
8787
return result
8888

8989
def check_query(self):

django_mongodb/features.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,6 @@ def django_test_expected_failures(self):
275275
"timezones.tests.NewDatabaseTests.test_query_annotation",
276276
},
277277
"QuerySet.annotate() has some limitations.": {
278-
# annotate() with combined expressions doesn't work:
279-
# 'WhereNode' object has no attribute 'field'
280-
"lookup.tests.LookupQueryingTests.test_combined_annotated_lookups_in_filter",
281-
"lookup.tests.LookupQueryingTests.test_combined_annotated_lookups_in_filter_false",
282-
"lookup.tests.LookupQueryingTests.test_combined_lookups",
283278
# Invalid $project :: caused by :: Unknown expression $count,
284279
"annotations.tests.NonAggregateAnnotationTestCase.test_combined_expression_annotation_with_aggregation",
285280
"annotations.tests.NonAggregateAnnotationTestCase.test_combined_f_expression_annotation_with_aggregation",

0 commit comments

Comments
 (0)