I\'m trying to create a form in Django. That works and all, but I want all the errors to be at the top of the form, not next to each field that has the error. I tried loopin
You can use this code:
{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}
{{ error|escape }}
{% endfor %}
{% endfor %}
{% for error in form.non_field_errors %}
{{ error|escape }}
{% endfor %}
{% endif %}
this add https://docs.djangoproject.com/en/3.0/ref/forms/api/#django.forms.Form.non_field_error