Reputation: 20895
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!
Upvotes: 0
Views: 1084
Reputation: 5570
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.
Upvotes: 3