#34435: JSONField with string default raises fields.E010 warning.
--------------------------------------+------------------------------------
     Reporter:  Tobias Krönke         |                    Owner:  stimver
         Type:  Bug                   |                   Status:  assigned
    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
--------------------------------------+------------------------------------

Comment (by stimver):

 Replying to [comment:4 Mariusz Felisiak]:
 > Replying to [comment:3 stimver]:
 > > As the warning suggests-  that the default value for the JSONField
 should be a callable function, rather than an instance, to avoid sharing
 the default value between all instances of the field. In the provided
 code, the default value is set to an empty string '', which is an instance
 of a string and therefore mutable.
 >
 > That's not true, strings are [https://docs.python.org/3/glossary.html
 #term-immutable immutable] and should be allowed as a default value.
 Can you suggest what changes should be done?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34435#comment:5>
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/010701878e6fe8a1-e30d25c3-ab48-41c8-8832-b6be109e6d63-000000%40eu-central-1.amazonses.com.

Reply via email to