I think this is all wrong , or am I really missing something ?
The Python style guide says less code is better (and I don't think that subjective ... is a fact), so consider this.
To use forms for all validations means that to write a subclass of the model field with custom validation, you need to:
- Subclass Models. Field
- Subclasses of forms.Field
- Add custom validation to your forms. Subclass
- Set the custom form field as the default form field for the custom model field.
- Always use the django model form if you want to check
With all the validation in the model, you just need to:
- Subclass Models. Field
- Add custom validation to your models. Subclass subclass
Now you can use your model field in the API, which bypasses all the use of web forms, and you should still have validation at the lowest level. If you used web forms, validation will spread up.
Is there a way to do this without having to write a Django command and wait for them to fix this error?
source share