diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 2053699c..cae36928 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -47,7 +47,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'mongodb-forks/django' - ref: 'mongodb-5.0.x' + ref: 'mongodb-5.1.x' path: 'django_repo' - name: Install system packages for Django's Python test dependencies run: | diff --git a/django_mongodb/__init__.py b/django_mongodb/__init__.py index 7994999d..9fe04e62 100644 --- a/django_mongodb/__init__.py +++ b/django_mongodb/__init__.py @@ -1,4 +1,4 @@ -__version__ = "5.0a0" +__version__ = "5.1a0" # Check Django compatibility before other imports which may fail if the # wrong version of Django is installed. diff --git a/django_mongodb/aggregates.py b/django_mongodb/aggregates.py index 35daab2c..d65e5520 100644 --- a/django_mongodb/aggregates.py +++ b/django_mongodb/aggregates.py @@ -1,7 +1,7 @@ from copy import deepcopy from django.db.models.aggregates import Aggregate, Count, StdDev, Variance -from django.db.models.expressions import Case, Value, When +from django.db.models.expressions import Case, Col, Value, When from django.db.models.lookups import IsNull from django.db.models.sql.where import WhereNode @@ -19,7 +19,7 @@ def aggregate( resolve_inner_expression=False, **extra_context, # noqa: ARG001 ): - if self.filter: + if self.filter and not isinstance(self.filter, Col): node = self.copy() node.filter = None source_expressions = node.get_source_expressions() diff --git a/django_mongodb/features.py b/django_mongodb/features.py index 2aa8217d..ca2fc5d7 100644 --- a/django_mongodb/features.py +++ b/django_mongodb/features.py @@ -26,6 +26,12 @@ class DatabaseFeatures(BaseDatabaseFeatures): uses_savepoints = False _django_test_expected_failures = { + # $concat only supports strings, not int + "db_functions.text.test_concat.ConcatTests.test_concat_non_str", + # QuerySet.order_by() with annotation transform doesn't work: + # "Expression $mod takes exactly 2 arguments. 1 were passed in" + # https://github.com/django/django/commit/b0ad41198b3e333f57351e3fce5a1fb47f23f376 + "aggregation.tests.AggregateTestCase.test_order_by_aggregate_transform", # Database defaults not supported: bson.errors.InvalidDocument: # cannot encode object: