mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #27003 -- Fixed JSONField crash on converted values.
This commit is contained in:
committed by
Tim Graham
parent
6573274161
commit
eed6150009
@@ -365,3 +365,13 @@ class TestFormField(PostgreSQLTestCase):
|
||||
|
||||
field = CustomJSONField()
|
||||
self.assertIsInstance(field.widget, widgets.Input)
|
||||
|
||||
def test_already_converted_value(self):
|
||||
field = forms.JSONField(required=False)
|
||||
tests = [
|
||||
'["a", "b", "c"]', '{"a": 1, "b": 2}', '1', '1.5', '"foo"',
|
||||
'true', 'false', 'null',
|
||||
]
|
||||
for json_string in tests:
|
||||
val = field.clean(json_string)
|
||||
self.assertEqual(field.clean(val), val)
|
||||
|
||||
Reference in New Issue
Block a user