Re: [Django] #34435: JSONField with string default raises fields.E010 warning. (was: JSONField with default='' raises warning "JSONField default should be a callable")

16 views
Skip to first unread message

Django

unread,
Mar 24, 2023, 8:37:51 AM3/24/23
to django-...@googlegroups.com
#34435: JSONField with string default raises fields.E010 warning.
--------------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: nobody
Type: Bug | Status: new
Component: Core (System checks) | Version: 4.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Sage Abdullah (added)
* type: Uncategorized => Bug
* component: Uncategorized => Core (System checks)
* stage: Unreviewed => Accepted


Comment:

Thanks for the report. Agreed, we should fix this, especially since it is
clearly
[https://docs.djangoproject.com/en/stable/ref/models/fields/#jsonfield
documented] as correct:
> ''"If you give the field a `default`, ensure it’s an immutable object,
**such as a `str`**, or a callable object that returns ..."''

--
Ticket URL: <https://code.djangoproject.com/ticket/34435#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages