1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

fix form error rendering

This commit is contained in:
checktheroads
2021-03-15 08:53:48 -07:00
parent b0d634a89e
commit a303a0dfb7

View File

@ -1,12 +1,16 @@
{% load form_helpers %} {% load form_helpers %}
{% load helpers %}
{% if form.errors or form.non_field_errors %} {% if form.errors or form.non_field_errors %}
<div class="alert alert-danger mt-3" role="alert"> <div class="alert alert-danger mt-3" role="alert">
<h4 class="alert-heading">Errors</h4> <h4 class="alert-heading">Errors</h4>
{% if form.errors %}
<hr /> <hr />
{% endif %}
<div class="ps-2"> <div class="ps-2">
{% if form.errors %} {% if form.errors %}
{% for field_name, errors in form.errors.items %} {% for field_name, errors in form.errors.items %}
{% if not field_name|startswith:'__' %}
{% with field=form|getfield:field_name %} {% with field=form|getfield:field_name %}
<strong>{{ field.label }}</strong> <strong>{{ field.label }}</strong>
<ul> <ul>
@ -15,6 +19,7 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endwith %} {% endwith %}
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if form.non_field_errors %} {% if form.non_field_errors %}