#35149: JSONField db_default requires wrapping values in json.dumps()
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: JSONField | Triage Stage: Ready for
db_default | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"761946f8e1b6d725f83fa4f3b04ca9750f486009" 761946f8]:
{{{#!CommitTicketReference repository=""
revision="761946f8e1b6d725f83fa4f3b04ca9750f486009"
[5.0.x] 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.
Backport of e67d7d70fa10c06aca36b9057f82054eda45269d from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35149#comment:18>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018d7462b769-a8a935f6-b256-474b-ba9b-b602e57a55b1-000000%40eu-central-1.amazonses.com.