Skip to content

Commit 4c960e0

Browse files
committed
update to Django 5.1
1 parent 546554a commit 4c960e0

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

.github/workflows/test-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/checkout@v4
3434
with:
3535
repository: 'mongodb-forks/django'
36-
ref: 'mongodb-5.0.x'
36+
ref: 'mongodb-5.1.x'
3737
path: 'django_repo'
3838
persist-credentials: false
3939
- name: Install system packages for Django's Python test dependencies

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,5 +1,5 @@
11
from django.db.models.aggregates import Aggregate, Count, StdDev, Variance
2-
from django.db.models.expressions import Case, Value, When
2+
from django.db.models.expressions import Case, Col, Value, When
33
from django.db.models.lookups import IsNull
44

55
from .query_utils import process_lhs
@@ -16,7 +16,7 @@ def aggregate(
1616
resolve_inner_expression=False,
1717
**extra_context, # noqa: ARG001
1818
):
19-
if self.filter:
19+
if self.filter and not isinstance(self.filter, Col):
2020
node = self.copy()
2121
node.filter = None
2222
source_expressions = node.get_source_expressions()

django_mongodb/features.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ class DatabaseFeatures(BaseDatabaseFeatures):
4646
uses_savepoints = False
4747

4848
_django_test_expected_failures = {
49+
# $concat only supports strings, not int
50+
"db_functions.text.test_concat.ConcatTests.test_concat_non_str",
51+
# QuerySet.order_by() with annotation transform doesn't work:
52+
# "Expression $mod takes exactly 2 arguments. 1 were passed in"
53+
# https://github.com/django/django/commit/b0ad41198b3e333f57351e3fce5a1fb47f23f376
54+
"aggregation.tests.AggregateTestCase.test_order_by_aggregate_transform",
4955
# 'NulledTransform' object has no attribute 'as_mql'.
5056
"lookup.tests.LookupTests.test_exact_none_transform",
5157
# "Save with update_fields did not affect any rows."
@@ -78,6 +84,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
7884
# Connection creation doesn't follow the usual Django API.
7985
"backends.tests.ThreadTests.test_pass_connection_between_threads",
8086
"backends.tests.ThreadTests.test_default_connection_thread_local",
87+
"test_utils.tests.DisallowedDatabaseQueriesTests.test_disallowed_thread_database_connection",
8188
# Object of type ObjectId is not JSON serializable.
8289
"auth_tests.test_views.LoginTest.test_login_session_without_hash_session_key",
8390
# GenericRelation.value_to_string() assumes integer pk.
@@ -151,7 +158,6 @@ def django_test_expected_failures(self):
151158
"constraints.tests.CheckConstraintTests.test_validate_rawsql_expressions_noop",
152159
},
153160
"MongoDB doesn't rename an index when a field is renamed.": {
154-
"migrations.test_operations.OperationTests.test_rename_field_index_together",
155161
"migrations.test_operations.OperationTests.test_rename_field_unique_together",
156162
},
157163
"Pattern lookups on UUIDField are not supported.": {
@@ -170,6 +176,7 @@ def django_test_expected_failures(self):
170176
"fixtures.tests.FixtureLoadingTests.test_loading_and_dumping",
171177
"m2m_through_regress.test_multitable.MultiTableTests.test_m2m_prefetch_proxied",
172178
"m2m_through_regress.test_multitable.MultiTableTests.test_m2m_prefetch_reverse_proxied",
179+
"many_to_many.tests.ManyToManyQueryTests.test_prefetch_related_no_queries_optimization_disabled",
173180
"many_to_many.tests.ManyToManyTests.test_add_after_prefetch",
174181
"many_to_many.tests.ManyToManyTests.test_add_then_remove_after_prefetch",
175182
"many_to_many.tests.ManyToManyTests.test_clear_after_prefetch",
@@ -381,7 +388,11 @@ def django_test_expected_failures(self):
381388
"delete.tests.DeletionTests.test_only_referenced_fields_selected",
382389
"expressions.tests.ExistsTests.test_optimizations",
383390
"lookup.tests.LookupTests.test_in_ignore_none",
391+
"lookup.tests.LookupTests.test_lookup_direct_value_rhs_unwrapped",
384392
"lookup.tests.LookupTests.test_textfield_exact_null",
393+
"many_to_many.tests.ManyToManyQueryTests.test_count_join_optimization_disabled",
394+
"many_to_many.tests.ManyToManyQueryTests.test_exists_join_optimization_disabled",
395+
"many_to_many.tests.ManyToManyTests.test_custom_default_manager_exists_count",
385396
"migrations.test_commands.MigrateTests.test_migrate_syncdb_app_label",
386397
"migrations.test_commands.MigrateTests.test_migrate_syncdb_deferred_sql_executed_with_schemaeditor",
387398
"queries.tests.ExistsSql.test_exists",
@@ -429,6 +440,7 @@ def django_test_expected_failures(self):
429440
"raw_query.tests.RawQueryTests",
430441
"schema.test_logging.SchemaLoggerTests.test_extra_args",
431442
"schema.tests.SchemaTests.test_remove_constraints_capital_letters",
443+
"test_utils.tests.AllowedDatabaseQueriesTests.test_allowed_database_copy_queries",
432444
"timezones.tests.LegacyDatabaseTests.test_cursor_execute_accepts_naive_datetime",
433445
"timezones.tests.LegacyDatabaseTests.test_cursor_execute_returns_naive_datetime",
434446
"timezones.tests.LegacyDatabaseTests.test_raw_sql",

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)