Add form errors

This commit is contained in:
Edgar P. Burkhart 2022-12-19 12:03:37 +01:00
parent 0e2fd6e74f
commit a7e3f92469
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,10 @@
{% if form.non_field_errors %}
<ul class='errorlist'>
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% for field in form %} {% for field in form %}
{{ field.errors }} {{ field.errors }}
<label for="{{ field.id_for_label }}">{{ field.label }}</label> <label for="{{ field.id_for_label }}">{{ field.label }}</label>

View file

@ -13,6 +13,13 @@
<form action="{% url 'login' %}" method="post"> <form action="{% url 'login' %}" method="post">
{% csrf_token %} {% csrf_token %}
{% if form.non_field_errors %}
<ul class='errorlist'>
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% for field in form %} {% for field in form %}
{{ field.errors }} {{ field.errors }}
<label for="{{ field.id_for_label }}">{{ field.label }}</label> <label for="{{ field.id_for_label }}">{{ field.label }}</label>