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
If you want something simple with a condition take this way :
{% if form.errors %}
{% for error in form.errors %}
- {{ error }}
{% endfor %}
{% endif %}
If you want more info and see the name and the error of the field, do this:
{% if form.errors %}
{% for key,value in form.errors.items %}
- {{ key|escape }} : {{ value|escape }}
{% endfor %}
{% endif %}
If you want to understant form.errors is a big dictionary.