Reputation: 17471
Is it possible to add form errors (not a field specific errors) to a form that is already validated (form.is_valid() is already called and the result is True)?
I have additional validation logic (with database requests) which I prefer to execute after standard form validation is passed, but it will be better to associate new errors with form
Or maybe I have to call this additional validation within clear() form function?
Upvotes: 0
Views: 1040
Reputation: 2228
Try to check it in the clean method of the form after all, but check existing errors before. Like that..
clean(self):
...
...
if not self._errors:
# your extra check
Upvotes: 2
Reputation: 42228
If this is validation based on database requests, then it shound as model validation.
Upvotes: 0