[Answer]-How to make custom Template for Django Form Wizard properly display validation errors?

1👍

The docs go over this thoroughly (https://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs#customizing-the-form-template). You can access and display the form errors and field errors by accessing them directly off the form and fields respectively. Here is an example.

{{ wizard.form.non_field_errors }}
<table>
    <tr>
        <th align="right">
            Comment #1
        </th>
        <td>
            {{ wizard.form.comment1 }}
        </td>
        {% if wizard.form.comment1.errors %}
        <td>{{ wizard.form.comment1.errors }}</td>
        {% endif %}
    </tr>
</table>

Leave a comment