Skip to content

Commit 1b9f0b5

Browse files
committed
update to Django 5.2
1 parent 4f247d5 commit 1b9f0b5

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
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.1.x'
36+
ref: 'mongodb-5.2.x'
3737
path: 'django_repo'
3838
persist-credentials: false
3939
- name: Install system packages for Django's Python test dependencies

django_mongodb_backend/__init__.py

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

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

django_mongodb_backend/features.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ class DatabaseFeatures(BaseDatabaseFeatures):
9494
# of $setIsSubset must be arrays. Second argument is of type: null"
9595
# https://jira.mongodb.org/browse/SERVER-99186
9696
"model_fields_.test_arrayfield.QueryingTests.test_contained_by_subquery",
97+
# Broken by https://github.com/django/django/commit/65ad4ade74dc9208b9d686a451cd6045df0c9c3a
98+
"aggregation.tests.AggregateTestCase.test_even_more_aggregate",
99+
"aggregation.tests.AggregateTestCase.test_grouped_annotation_in_group_by",
100+
"aggregation.tests.AggregateTestCase.test_non_grouped_annotation_not_in_group_by",
101+
"aggregation_regress.tests.AggregationTests.test_aggregate_fexpr",
102+
"aggregation_regress.tests.AggregationTests.test_values_list_annotation_args_ordering",
103+
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_subquery_and_aggregate_values_chaining",
104+
"annotations.tests.NonAggregateAnnotationTestCase.test_values_fields_annotations_order",
105+
"queries.test_qs_combinators.QuerySetSetOperationTests.test_union_multiple_models_with_values_and_datetime_annotations",
106+
"queries.test_qs_combinators.QuerySetSetOperationTests.test_union_multiple_models_with_values_list_and_datetime_annotations",
107+
"queries.test_qs_combinators.QuerySetSetOperationTests.test_union_multiple_models_with_values_list_and_annotations",
108+
"queries.test_qs_combinators.QuerySetSetOperationTests.test_union_with_field_and_annotation_values",
109+
"queries.test_qs_combinators.QuerySetSetOperationTests.test_union_with_two_annotated_values_list",
110+
"queries.tests.Queries1Tests.test_union_values_subquery",
111+
# pymongo.errors.WriteError: Performing an update on the path '_id'
112+
# would modify the immutable field '_id'
113+
"migrations.test_operations.OperationTests.test_composite_pk_operations",
97114
}
98115
# $bitAnd, #bitOr, and $bitXor are new in MongoDB 6.3.
99116
_django_test_expected_failures_bitwise = {
@@ -205,9 +222,13 @@ def django_test_expected_failures(self):
205222
"prefetch_related.tests.Ticket21410Tests",
206223
"queryset_pickle.tests.PickleabilityTestCase.test_pickle_prefetch_related_with_m2m_and_objects_deletion",
207224
"serializers.test_json.JsonSerializerTestCase.test_serialize_prefetch_related_m2m",
225+
"serializers.test_json.JsonSerializerTestCase.test_serialize_prefetch_related_m2m_with_natural_keys",
208226
"serializers.test_jsonl.JsonlSerializerTestCase.test_serialize_prefetch_related_m2m",
227+
"serializers.test_jsonl.JsonlSerializerTestCase.test_serialize_prefetch_related_m2m_with_natural_keys",
209228
"serializers.test_xml.XmlSerializerTestCase.test_serialize_prefetch_related_m2m",
229+
"serializers.test_xml.XmlSerializerTestCase.test_serialize_prefetch_related_m2m_with_natural_keys",
210230
"serializers.test_yaml.YamlSerializerTestCase.test_serialize_prefetch_related_m2m",
231+
"serializers.test_yaml.YamlSerializerTestCase.test_serialize_prefetch_related_m2m_with_natural_keys",
211232
},
212233
"AutoField not supported.": {
213234
"bulk_create.tests.BulkCreateTests.test_bulk_insert_nullable_fields",
@@ -605,6 +626,9 @@ def django_test_expected_failures(self):
605626
"foreign_object.tests.MultiColumnFKTests",
606627
"foreign_object.tests.TestExtraJoinFilterQ",
607628
},
629+
"Tuple lookups are not supported.": {
630+
"foreign_object.test_tuple_lookups.TupleLookupsTests",
631+
},
608632
"Custom lookups are not supported.": {
609633
"custom_lookups.tests.BilateralTransformTests",
610634
"custom_lookups.tests.LookupTests.test_basic_lookup",

django_mongodb_backend/lookups.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.db import NotSupportedError
2-
from django.db.models.fields.related_lookups import In, MultiColSource, RelatedIn
2+
from django.db.models.expressions import ColPairs
3+
from django.db.models.fields.related_lookups import In, RelatedIn
34
from django.db.models.lookups import (
45
BuiltinLookup,
56
FieldGetDbPrepValueIterableMixin,
@@ -34,8 +35,8 @@ def field_resolve_expression_parameter(self, compiler, connection, sql, param):
3435

3536

3637
def in_(self, compiler, connection):
37-
if isinstance(self.lhs, MultiColSource):
38-
raise NotImplementedError("MultiColSource is not supported.")
38+
if isinstance(self.lhs, ColPairs):
39+
raise NotImplementedError("ColPairs is not supported.")
3940
db_rhs = getattr(self.rhs, "_db", None)
4041
if db_rhs is not None and db_rhs != connection.alias:
4142
raise ValueError(

django_mongodb_backend/operations.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -195,28 +195,6 @@ def execute_sql_flush(self, tables):
195195
if not options.get("capped", False):
196196
collection.delete_many({})
197197

198-
def prep_lookup_value(self, value, field, lookup):
199-
"""
200-
Perform type-conversion on `value` before using as a filter parameter.
201-
"""
202-
if getattr(field, "rel", None) is not None:
203-
field = field.rel.get_related_field()
204-
field_kind = field.get_internal_type()
205-
206-
if lookup in ("in", "range"):
207-
return [
208-
self._prep_lookup_value(subvalue, field, field_kind, lookup) for subvalue in value
209-
]
210-
return self._prep_lookup_value(value, field, field_kind, lookup)
211-
212-
def _prep_lookup_value(self, value, field, field_kind, lookup):
213-
if value is None:
214-
return None
215-
216-
if field_kind == "DecimalField":
217-
value = self.adapt_decimalfield_value(value, field.max_digits, field.decimal_places)
218-
return value
219-
220198
def explain_query_prefix(self, format=None, **options):
221199
# Validate options.
222200
validated_options = {}

django_mongodb_backend/query_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ def process_rhs(node, compiler, connection):
4444
value = value[0]
4545
if hasattr(node, "prep_lookup_value_mongo"):
4646
value = node.prep_lookup_value_mongo(value)
47-
# No need to prepare expressions like F() objects.
48-
if hasattr(rhs, "resolve_expression"):
49-
return value
50-
return connection.ops.prep_lookup_value(value, node.lhs.output_field, node.lookup_name)
47+
return value
5148

5249

5350
def regex_match(field, regex_vals, insensitive=False):

0 commit comments

Comments
 (0)