{% load string_filters i18n %}{% spaceless %}

{% for field, details in errors.items %}
    <h3>{{field}}{% if details.related_field %} - {{details.related_field}}{% endif %}</h3>
    <p>{{details.message}}</p>
{% endfor %}

<h1>{% trans "Items" %}</h1>
{% for field, details in errors.items %}
    <h2>{{field}}{% if details.related_field %} - {{details.related_field}}{% endif %}</h2>
    
    {% if is_single_column %}
        <p>{{ details.records }}</p>
    {% else %}
        <table>
            <thead>
                <tr>
                    {% for identifier in identifiers %}
                        <th>{{identifier}}</th>
                    {% endfor %}
                </tr>
            </thead>
            <tbody>
                {% for record in details.records %}
                    <tr>
                        {% for item in record|split:", " %}
                            <td>{{item}}</td>
                        {% endfor %}
                    </tr>
                {% endfor %}
            </tbody>
        </table>
        <hr>
    {% endif %}
{% endfor %}

{% endspaceless %}