I am performing some more validation fater the main form has been validated.
I am using class based views
def form_valid(self, request, *args, **kwargs):
some custom logic
if(false)
Here i want to return to form invalid page with my custom message
I am processing the file in form_valid and thats got many steps which i need to check for more validation. so i don’t want to move all that logic out to another function
You shouldn’t be doing validation in
form_valid. Do it in the form, either inForm.cleanorForm.clean_FOO. Refer to the Django documentation on form validation.If you insist on mutilating your code-base, then try the following: