From e67d7d70fa10c06aca36b9057f82054eda45269d Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 28 Jan 2024 12:02:33 -0500 Subject: Fixed #35149 -- Fixed crashes of db_default with unresolvable output field. Field.db_default accepts either literal Python values or compilables (as_sql) and wrap the former ones in Value internally. While 1e38f11 added support for automatic resolving of output fields for types such as str, int, float, and other unambigous ones it's cannot do so for all types such as dict or even contrib.postgres and contrib.gis primitives. When a literal, non-compilable, value is provided it likely make the most sense to bind its output field to the field its attached to avoid forcing the user to provide an explicit `Value(output_field)`. Thanks David Sanders for the report. --- docs/releases/5.0.2.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs') diff --git a/docs/releases/5.0.2.txt b/docs/releases/5.0.2.txt index a385fbd13e..6312dee312 100644 --- a/docs/releases/5.0.2.txt +++ b/docs/releases/5.0.2.txt @@ -36,3 +36,8 @@ Bugfixes * Fixed a bug in Django 5.0 that caused a migration crash on MySQL when adding a ``BinaryField``, ``TextField``, ``JSONField``, or ``GeometryField`` with a ``db_default`` (:ticket:`35162`). + +* Fixed a bug in Django 5.0 that caused a migration crash on models with a + literal ``db_default`` of a complex type such as ``dict`` instance of a + ``JSONField``. Running ``makemigrations`` might generate no-op ``AlterField`` + operations for fields using ``db_default`` (:ticket:`35149`). -- cgit v1.3