#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
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"e67d7d70fa10c06aca36b9057f82054eda45269d" e67d7d70]:
{{{#!CommitTicketReference repository=""
revision="e67d7d70fa10c06aca36b9057f82054eda45269d"
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.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35149#comment:16>
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/0107018d74607c4e-0e94a8f0-e7cc-4c47-944d-052a5fc02ee8-000000%40eu-central-1.amazonses.com.