[Answer]-Date validation giving error "strftime' is not defined"

1👍

strftime is a method found on datetime objects to convert them to strings.

Your error is quite simple: it’s not defined. If you opened a python shell and typed in Royal, would you expect an error? Same thing.


By the time clean is called, the datetime object has already been constructed. There is no input type validation at this point – it’s already been converted to a datetime.

0👍

while raising error use forms.ValidationError not just ValidationError see https://docs.djangoproject.com/en/dev/ref/forms/validation/

Leave a comment