render_errors.html 644 B

1234567891011121314151617181920212223242526
  1. {% load form_helpers %}
  2. {% if form.errors or form.non_field_errors %}
  3. <div class="alert alert-danger mt-3" role="alert">
  4. <h4 class="alert-heading">Errors</h4>
  5. <hr />
  6. <div class="ps-2">
  7. {% if form.errors %}
  8. {% for field_name, errors in form.errors.items %}
  9. {% with field=form|getfield:field_name %}
  10. <strong>{{ field.label }}</strong>
  11. <ul>
  12. {% for error in errors %}
  13. <li>{{ error }}</li>
  14. {% endfor %}
  15. </ul>
  16. {% endwith %}
  17. {% endfor %}
  18. {% endif %}
  19. {% if form.non_field_errors %}
  20. <hr />
  21. {{ form.non_field_errors }}
  22. {% endif %}
  23. </div>
  24. </div>
  25. {% endif %}