#26949: Disabled forms.JSONField crashes with TypeError
--------------------------------------------+---------------------
               Reporter:  timgraham         |          Owner:
                   Type:  Bug               |         Status:  new
              Component:  contrib.postgres  |        Version:  1.9
               Severity:  Normal            |       Keywords:
           Triage Stage:  Accepted          |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+---------------------
 The fix for #25532 is partially reverted to fix the regression in #26917
 but this means the following test fails with `TypeError: the JSON object
 must be str, not 'list'.`:

 {{{ #!python
 def test_formfield_disabled(self):
     class JsonForm(Form):
         name = CharField()
         jfield = forms.JSONField(disabled=True)

     form = JsonForm({'name': 'xyz', 'jfield': '["bar"]'},
 initial={'jfield': ['foo']})
     self.assertIn('[&quot;foo&quot;]</textarea>', form.as_p())
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26949>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.d8cac043c15275a53d4ef5a4c314d016%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to