`JSONFormField.clean` should return a python object and not it's string representation.
charettes opened this issue · comments
Is there a reason why you don't return the json.loads
?
e.g. forms.DateField.clean
returns a date
and forms.BooleanField.clean
returns a bool
.
In my case, I only needed to validate the JSON and return it. However, I can see how returning a Python object would be useful. Perhaps a flag parameter on clean
would be best.
This is definitely a misbehavior, does IntegerField.clean
returns a an integer in it's string form '123'
or as integer int
.
Stating Django's form documentation:
In general, any cleaning method can raise ValidationError if there is a problem with the data
it is processing, passing the relevant error message to the ValidationError constructor. If no
ValidationError is raised, the method should return the cleaned (normalized) data as
a Python object.
Indeed. This will be taken care of soonTM. Pull requests are always welcome.
Change applied.