[Answer]-Displaying the dictionnary values of error_messages

1👍

Right now, you are looking at the fields that have errors.

If you want to access the errors for a specific field, you need to loop over each field and then loop over each error in each field.

{% for field in regform %}
    {{ field }}

    {% for error in field.errors %}
        <small id="error_{{ forloop.counter }}_{{ field.auto_id }}">{{ error|safe }}</small>
    {% endfor %}
{% endfor %}

What you are accessing is useful to set classes based on whether there were any errors at all in the form (for things like bootstrap or displaying a message like you do)

Leave a comment