2👍
✅
You could take some inspiration from Django’s forms framework, and raise some sort of validation exception. Then a separate ‘validate’ method could call all the validation functions, catch any exceptions, and output the correct JSON result.
Or, you could simply use a Django form directly, which might be simpler all around.
Source:stackexchange.com