0

I have a form in a Django template. I am aware that I can display errors related to a specific field via

 {% for e in field.errors %}{{ e }}{% endfor %}

However, how do I obtain errors specific to the form itself such as the errors returned by an overall clean function in a form?

Thanks!

2 Answers 2

3

You can access non-field errors via form.non_field_errors(). See https://docs.djangoproject.com/en/dev/ref/forms/validation/#form-and-field-validation.

Sign up to request clarification or add additional context in comments.

Comments

2

Use {{ form.non_field_errors }}.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.