{{{ #!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('["foo"]</textarea>', form.as_p())
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26949>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: => alexyer
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:1>
* Attachment "0001-Fix-disabled-forms.JSONField-crash-with-
TypeError.patch" added.
As I see the problem with previous fix was because assumption that initial
values are already cleaned is wrong. I added these lines to omit
`json.loads()` for disable field. But I think that's the obvious fix,
means there are downsides here if it's not been done before, so I'm not
sure about it. Could you, please, advice what could be wrong with this
approach? Thanks!
* has_patch: 0 => 1
Comment:
Looks okay to me. I added that fix to my
[https://github.com/django/django/pull/6972 PR] for the other ticket.
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:2>
Comment (by alexyer):
Should I create PR for the 1.9 branch or it's not required?
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:3>
Comment (by timgraham):
Not needed since the committer will backport any commits as needed. I
think I'll just backport to 1.10 only since 1.9.x will be in security fix
only mode after the 1.10 release next week.
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:4>
Comment (by alexyer):
Ok. Thanks for the fast and clear response!
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:5>
Comment (by Tim Graham <timograham@…>):
In [changeset:"a5f85d891b51d7ceb4f9e422e3e4f5c741062288" a5f85d89]:
{{{
#!CommitTicketReference repository=""
revision="a5f85d891b51d7ceb4f9e422e3e4f5c741062288"
Fixed #26917 -- Fixed crash in disabled ModelChoiceFields.
Partially reverted refs #25532 to fix a regression in Django 1.10.
This reintroduces a crash for disabled forms.JSONField (refs #26949),
however, that issue is also present on Django 1.9.
Thanks Ryan Schave for the test.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"68de48c96328e13d5dbdb1f3006e4a1ca74f3c34" 68de48c]:
{{{
#!CommitTicketReference repository=""
revision="68de48c96328e13d5dbdb1f3006e4a1ca74f3c34"
Fixed #26949 -- Fixed crash of disabled forms.JSONField.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:7>
Comment (by Tim Graham <timograham@…>):
In [changeset:"3744fc1666c41aeb4ed44f31605bafdb413b42bc" 3744fc1]:
{{{
#!CommitTicketReference repository=""
revision="3744fc1666c41aeb4ed44f31605bafdb413b42bc"
[1.10.x] Fixed #26917 -- Fixed crash in disabled ModelChoiceFields.
Partially reverted refs #25532 to fix a regression in Django 1.10.
This reintroduces a crash for disabled forms.JSONField (refs #26949),
however, that issue is also present on Django 1.9.
Thanks Ryan Schave for the test.
Backport of a5f85d891b51d7ceb4f9e422e3e4f5c741062288 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"714e287d9a2b8ca7668a951e7193d9bbae3c3162" 714e287d]:
{{{
#!CommitTicketReference repository=""
revision="714e287d9a2b8ca7668a951e7193d9bbae3c3162"
[1.10.x] Fixed #26949 -- Fixed crash of disabled forms.JSONField.
Backport of 68de48c96328e13d5dbdb1f3006e4a1ca74f3c34 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26949#comment:9>