From 342d16d935ee31b3487a3c44bf1a70b21c54aab0 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 12 Jul 2024 14:25:38 -0400 Subject: [PATCH] fix QuerySet.annotate() crash with combined expression --- django_mongodb/compiler.py | 2 +- django_mongodb/features.py | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/django_mongodb/compiler.py b/django_mongodb/compiler.py index 7f293dd01..314dd39f4 100644 --- a/django_mongodb/compiler.py +++ b/django_mongodb/compiler.py @@ -83,7 +83,7 @@ def _make_result(self, entity, columns): if column_alias is not None and column_alias != self.collection_name else entity ) - result.append(obj.get(name, col.field.get_default())) + result.append(obj.get(name)) return result def check_query(self): diff --git a/django_mongodb/features.py b/django_mongodb/features.py index e94662047..f0bba7d00 100644 --- a/django_mongodb/features.py +++ b/django_mongodb/features.py @@ -275,11 +275,6 @@ def django_test_expected_failures(self): "timezones.tests.NewDatabaseTests.test_query_annotation", }, "QuerySet.annotate() has some limitations.": { - # annotate() with combined expressions doesn't work: - # 'WhereNode' object has no attribute 'field' - "lookup.tests.LookupQueryingTests.test_combined_annotated_lookups_in_filter", - "lookup.tests.LookupQueryingTests.test_combined_annotated_lookups_in_filter_false", - "lookup.tests.LookupQueryingTests.test_combined_lookups", # Invalid $project :: caused by :: Unknown expression $count, "annotations.tests.NonAggregateAnnotationTestCase.test_combined_expression_annotation_with_aggregation", "annotations.tests.NonAggregateAnnotationTestCase.test_combined_f_expression_annotation_with_aggregation",