[Answer]-Django form custom Date validation

1👍

Add a Form validation.

If you want to validate on model save, use django pre_save signal

0👍

I would put the validation in both the model and the template. Yes, that’s twice the work in two different languages (Python and Javascript), but you’ll get cleaner data this way. Here’s one way to do this in jQuery: end date greater than start date – jquery validation.

The model is the place to put all data validation for that model. Create a method that takes all the parameters and raises exceptions (ValueError, etc.) if the data is incorrect.

Leave a comment