Skip to content

Commit 73df229

Browse files
committed
update for Django 5.2
1 parent a8cd1f9 commit 73df229

File tree

9 files changed

+37
-16
lines changed

9 files changed

+37
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Changelog
22

3-
## 5.1.1 - Unreleased
3+
## 5.2 - Unreleased
44

5-
- Confirmed support for CockroachDB 24.2.x, 24.3.x, and 25.1.x (no code changes
6-
required).
7-
8-
## 5.1 - 2024-08-13
9-
10-
Initial release for Django 5.1.x and CockroachDB 23.1.x, 23.2.x, and 24.1.x.
5+
Initial release for Django 5.2.x and CockroachDB 23.2.x, 24.1.x, 24.3.x, and
6+
25.1.x.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ production it is advised to use the package built from sources.
2121
## Install and usage
2222

2323
Use the version of django-cockroachdb that corresponds to your version of
24-
Django. For example, to get the latest compatible release for Django 5.1.x:
24+
Django. For example, to get the latest compatible release for Django 5.2.x:
2525

26-
`pip install django-cockroachdb==5.1.*`
26+
`pip install django-cockroachdb==5.2.*`
2727

2828
The minor release number of Django doesn't correspond to the minor release
2929
number of django-cockroachdb. Use the latest minor release of each.

django-test-suite/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VERSION=$1
77

88
# clone django into the repo.
99
rm -rf _django_repo
10-
git clone --depth 1 --single-branch --branch cockroach-5.1.x https://github.com/timgraham/django _django_repo
10+
git clone --depth 1 --single-branch --branch cockroach-5.2.x https://github.com/timgraham/django _django_repo
1111

1212
# install the django requirements.
1313
cd _django_repo/tests/

django_cockroachdb/__init__.py

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

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

django_cockroachdb/features.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ def django_test_expected_failures(self):
150150
'schema.tests.SchemaTests.test_text_field_with_db_index_to_fk',
151151
# CockroachDB doesn't support dropping the primary key.
152152
'schema.tests.SchemaTests.test_alter_int_pk_to_int_unique',
153+
# unimplemented: primary key dropped without subsequent addition of
154+
# new primary key in same transaction
155+
# https://github.com/cockroachdb/cockroach/issues/48026
156+
'migrations.test_operations.OperationTests.test_composite_pk_operations',
153157
# CockroachDB doesn't support changing the primary key of table.
154158
# psycopg.errors.InvalidColumnReference: column "id" is referenced
155159
# by the primary key
@@ -165,6 +169,7 @@ def django_test_expected_failures(self):
165169
'many_to_one.tests.ManyToOneTests.test_get_prefetch_querysets_reverse_invalid_querysets_length',
166170
'migrations.test_operations.OperationTests.test_smallfield_autofield_foreignfield_growth',
167171
'migrations.test_operations.OperationTests.test_smallfield_bigautofield_foreignfield_growth',
172+
'schema.tests.SchemaTests.test_alter_smallint_pk_to_smallautofield_pk',
168173
# unexpected unique index in pg_constraint query:
169174
# https://github.com/cockroachdb/cockroach/issues/61098
170175
'introspection.tests.IntrospectionTests.test_get_constraints_unique_indexes_orders',
@@ -193,7 +198,7 @@ def django_test_expected_failures(self):
193198
'migrations.test_operations.OperationTests.test_alter_field_reloads_state_on_fk_with_to_field_target_changes', # noqa
194199
'migrations.test_operations.OperationTests.test_rename_field_reloads_state_on_fk_target_changes',
195200
# unknown signature: concat(varchar, int) (returning <string>)
196-
'migrations.test_operations.OperationTests.test_add_generate_field',
201+
'migrations.test_operations.OperationTests.test_add_generated_field',
197202
# concat(): unknown signature: concat(string, int2) (desired <string>)
198203
'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
199204
})
@@ -204,12 +209,19 @@ def django_test_expected_failures(self):
204209
'schema.tests.SchemaTests.test_alter_text_field_to_datetime_field',
205210
'schema.tests.SchemaTests.test_alter_text_field_to_time_field',
206211
})
212+
if self.is_cockroachdb_25_1:
213+
expected_failures.update({
214+
# expected STORED COMPUTED COLUMN expression to have type
215+
# decimal, but 'pink + pink' has type int
216+
'migrations.test_operations.OperationTests.test_generated_field_changes_output_field',
217+
})
207218
if self.uses_server_side_binding:
208219
expected_failures.update({
209220
# could not determine data type of placeholder:
210221
# https://github.com/cockroachdb/cockroach/issues/91396
211222
'backends.tests.EscapingChecks.test_parameter_escaping',
212223
'backends.tests.EscapingChecksDebug.test_parameter_escaping',
224+
'composite_pk.test_update.CompositePKUpdateTests.test_bulk_update_comments',
213225
'constraints.tests.CheckConstraintTests.test_database_default',
214226
'expressions.tests.BasicExpressionsTests.test_annotate_values_filter',
215227
'expressions_case.tests.CaseDocumentationExamples.test_lookup_example',

django_cockroachdb/functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from django.db.models.expressions import When
77
from django.db.models.functions import (
88
ACos, ASin, ATan, ATan2, Cast, Ceil, Coalesce, Collate, Cos, Cot, Degrees,
9-
Exp, Floor, JSONObject, Ln, Log, Radians, Round, Sin, Sqrt, StrIndex, Tan,
9+
Exp, Floor, JSONArray, JSONObject, Ln, Log, Radians, Round, Sin, Sqrt,
10+
StrIndex, Tan,
1011
)
1112

1213

@@ -76,6 +77,7 @@ def register_functions():
7677
func.as_cockroachdb = float_cast
7778
Coalesce.as_cockroachdb = coalesce
7879
Collate.as_cockroachdb = collate
80+
JSONArray.as_cockroachdb = JSONArray.as_postgresql
7981
JSONObject.as_cockroachdb = JSONObject.as_postgresql
8082
Round.as_cockroachdb = round_cast
8183
StrIndex.as_cockroachdb = StrIndex.as_postgresql

django_cockroachdb_gis/features.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django.contrib.gis.db.backends.postgis.features import (
22
DatabaseFeatures as PostGISFeatures,
33
)
4+
from django.db.backends.postgresql.psycopg_any import is_psycopg3
45
from django.utils.functional import cached_property
56

67
from django_cockroachdb.features import DatabaseFeatures as CockroachFeatures
@@ -68,10 +69,20 @@ def django_test_expected_failures(self):
6869
# data is currently not supported for columns that are part of an
6970
# index: https://github.com/cockroachdb/cockroach/issues/47636
7071
'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_geom_field_dim',
72+
'gis_tests.gis_migrations.test_operations.OperationTests.test_alter_field_with_spatial_index',
7173
# 3D opclass not present on CockroachDB:
7274
# https://github.com/cockroachdb/cockroach/issues/47420#issuecomment-969578772
7375
'gis_tests.gis_migrations.test_operations.OperationTests.test_add_3d_field_opclass',
7476
})
77+
if is_psycopg3 and not self.is_cockroachdb_24_1:
78+
expected_failures.update({
79+
# QuerySet.bulk_create() doesn't work with geometries after
80+
# https://github.com/django/django/commit/a16eedcf9c69d8a11d94cac1811018c5b996d491
81+
# could not parse geometry: error parsing EWKB hex: encoding/hex:
82+
# invalid byte: U+003A ':'
83+
# https://github.com/cockroachdb/cockroach/issues/138140
84+
'gis_tests.geoapp.test_functions.GISFunctionsTests.test_area_lookups',
85+
})
7586
if self.uses_server_side_binding:
7687
expected_failures.update({
7788
# unknown signature: st_scale(geometry, int, int)

django_cockroachdb_gis/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
)
66

77

8-
class DatabaseSchemaEditor(CockroachSchemaEditor, PostGISSchemaEditor):
8+
class DatabaseSchemaEditor(PostGISSchemaEditor, CockroachSchemaEditor):
99
pass

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ long_description_content_type = text/markdown
1111
classifiers =
1212
Development Status :: 5 - Production/Stable
1313
Framework :: Django
14-
Framework :: Django :: 5.1
14+
Framework :: Django :: 5.2
1515
License :: OSI Approved :: Apache Software License
1616
Operating System :: OS Independent
1717
Programming Language :: Python
@@ -28,7 +28,7 @@ project_urls =
2828
python_requires = >=3.10
2929
packages = find:
3030
install_requires =
31-
django >= 5.1, < 5.2
31+
django >= 5.2, < 6.0
3232

3333
[flake8]
3434
max-line-length = 119

0 commit comments

Comments
 (0)