[Fixed]-Django form errors prints __all__

29👍

Ah, I should have used:

{{ form.non_field_errors }}

instead

👤Asdf

5👍

If you, like me, still want to display ALL errors at once, you can loop over form.errors.items.

This line:

{{ form.errors }}

Becomes this: (or similar)

<ul class="errorlist">
    {% for key, value in form.errors.items %}
    <li>{% if key != '__all__' %}{{ key }} {% endif %}{{ value }}</li>
    {% endfor %}
</ul>
👤graup

Leave a comment