Remove django form field validation errors manually

Original post at Makina Corpus

Sometimes I look for something which seems so simple and stupid that I can't imagine it does not exist. It makes me wonder why and who is the fool. Worse, I can't be sure about my search keywords to prove me anything.

I just wanted to delete, reset or remove the validation errors of a single form field, within a django view, without overriding the form or field class.

A one-liner

aform.errors['afield'] = aform['afield'].error_class()

That's it folks !

#django, #tips - Posted in the Dev category