Skip to content

Commit 9ec98b9

Browse files
committed
update to Django 5.1
1 parent 9dd5f08 commit 9ec98b9

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

.github/workflows/test-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/checkout@v4
4848
with:
4949
repository: 'mongodb-forks/django'
50-
ref: 'mongodb-5.0.x'
50+
ref: 'mongodb-5.1.x'
5151
path: 'django_repo'
5252
- name: Install system packages for Django's Python test dependencies
5353
run: |

django_mongodb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "5.0a0"
1+
__version__ = "5.1a0"
22

33
# Check Django compatibility before other imports which may fail if the
44
# wrong version of Django is installed.

django_mongodb/aggregates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from copy import deepcopy
22

33
from django.db.models.aggregates import Aggregate, Count, StdDev, Variance
4-
from django.db.models.expressions import Case, Value, When
4+
from django.db.models.expressions import Case, Col, Value, When
55
from django.db.models.lookups import IsNull
66
from django.db.models.sql.where import WhereNode
77

@@ -19,7 +19,7 @@ def aggregate(
1919
resolve_inner_expression=False,
2020
**extra_context, # noqa: ARG001
2121
):
22-
if self.filter:
22+
if self.filter and not isinstance(self.filter, Col):
2323
node = self.copy()
2424
node.filter = None
2525
source_expressions = node.get_source_expressions()

django_mongodb/features.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
2626
uses_savepoints = False
2727

2828
_django_test_expected_failures = {
29+
# $concat only supports strings, not int
30+
"db_functions.text.test_concat.ConcatTests.test_concat_non_str",
2931
# Database defaults not supported: bson.errors.InvalidDocument:
3032
# cannot encode object: <django.db.models.expressions.DatabaseDefault
3133
"basic.tests.ModelInstanceCreationTests.test_save_primary_with_db_default",
@@ -51,7 +53,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
5153
# Length of null considered zero rather than null.
5254
"db_functions.text.test_length.LengthTests.test_basic",
5355
# range lookup includes incorrect values.
54-
"expressions.tests.IterableLookupInnerExpressionsTests.test_expressions_in_lookups_join_choice",
56+
"expressions.tests.IterableLookupInnerExpressionsTests.test_expressions_range_lookups_join_choice",
5557
# Unexpected alias_refcount in alias_map.
5658
"queries.tests.Queries1Tests.test_order_by_tables",
5759
# The $sum aggregation returns 0 instead of None for null.
@@ -130,6 +132,8 @@ def django_test_expected_failures(self):
130132
"expressions.tests.BasicExpressionsTests.test_object_update_unsaved_objects",
131133
"expressions.tests.BasicExpressionsTests.test_order_of_operations",
132134
"expressions.tests.BasicExpressionsTests.test_parenthesis_priority",
135+
"expressions.tests.BasicExpressionsTests.test_slicing_of_f_expressions_charfield",
136+
"expressions.tests.BasicExpressionsTests.test_slicing_of_f_expressions_textfield",
133137
"expressions.tests.BasicExpressionsTests.test_update",
134138
"expressions.tests.BasicExpressionsTests.test_update_with_fk",
135139
"expressions.tests.BasicExpressionsTests.test_update_with_none",
@@ -227,6 +231,7 @@ def django_test_expected_failures(self):
227231
"expressions.tests.BasicExpressionsTests.test_case_in_filter_if_boolean_output_field",
228232
"expressions.tests.BasicExpressionsTests.test_exists_in_filter",
229233
"expressions.tests.BasicExpressionsTests.test_order_by_exists",
234+
"expressions.tests.BasicExpressionsTests.test_slicing_of_outerref",
230235
"expressions.tests.BasicExpressionsTests.test_subquery",
231236
"expressions.tests.ExistsTests.test_filter_by_empty_exists",
232237
"expressions.tests.ExistsTests.test_negated_empty_exists",
@@ -333,6 +338,7 @@ def django_test_expected_failures(self):
333338
"queries.tests.EmptyQuerySetTests.test_values_subquery",
334339
"queries.tests.ExcludeTests.test_exclude_subquery",
335340
"queries.tests.NullInExcludeTest.test_null_in_exclude_qs",
341+
"queries.tests.Queries1Tests.test_combining_does_not_mutate",
336342
"queries.tests.Queries1Tests.test_ticket9985",
337343
"queries.tests.Queries1Tests.test_ticket9997",
338344
"queries.tests.Queries1Tests.test_ticket10742",
@@ -446,6 +452,7 @@ def django_test_expected_failures(self):
446452
"aggregation.tests.AggregateTestCase.test_count_star",
447453
"delete.tests.DeletionTests.test_only_referenced_fields_selected",
448454
"lookup.tests.LookupTests.test_in_ignore_none",
455+
"lookup.tests.LookupTests.test_lookup_direct_value_rhs_unwrapped",
449456
"lookup.tests.LookupTests.test_textfield_exact_null",
450457
"queries.tests.ExistsSql.test_exists",
451458
"queries.tests.Queries6Tests.test_col_alias_quoted",

django_mongodb/query_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def process_lhs(node, compiler, connection):
1212
# node is a Func or Expression, possibly with multiple source expressions.
1313
result = []
1414
for expr in node.get_source_expressions():
15+
if expr is None:
16+
continue
1517
try:
1618
result.append(expr.as_mql(compiler, connection))
1719
except FullResultSet:

0 commit comments

Comments
 (0)