This commit is contained in:
Sebastien Corbin
2022-01-17 13:44:27 +01:00
committed by Sébastien Corbin
parent 63c3d7d2dc
commit 382c824cca
3 changed files with 27 additions and 23 deletions

View File

@@ -18,13 +18,13 @@ class JSignatureField(Field):
widget = JSignatureWidget()
def to_python(self, value):
"""
Validates that the input can be red as a JSON object.
Returns a Python list (JSON object unserialized).
"""
if value in JSIGNATURE_EMPTY_VALUES:
return None
try:
return json.loads(value)
except ValueError:
raise ValidationError('Invalid JSON format.')
"""
Validates that the input can be red as a JSON object.
Returns a Python list (JSON object unserialized).
"""
if value in JSIGNATURE_EMPTY_VALUES:
return None
try:
return json.loads(value)
except ValueError:
raise ValidationError('Invalid JSON format.')