Login form errors fixed
This commit is contained in:
parent
7e0aca33b0
commit
4bbda000ae
|
@ -8,8 +8,10 @@
|
||||||
{% if login_form.errors %}
|
{% if login_form.errors %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
{% for key, error in login_form.errors.items %}
|
{% for field, error in login_form.errors.items %}
|
||||||
toastr.error('{{ error }}');
|
{% if field == '__all__' %}
|
||||||
|
toastr.error('{{ error|striptags }}');
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -26,9 +28,12 @@ $(function(){
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% for field in login_form %}
|
{% for field in login_form %}
|
||||||
<div class="form-group {% if field.errors %}has-error has-feedback{% endif %} form-horizontal">
|
<div class="form-group {% if field.errors %}has-error has-feedback{% endif %} form-horizontal">
|
||||||
|
{% for error in field.errors %}
|
||||||
|
<p><span class="label label-danger">{{ error|striptags }}</span></p>
|
||||||
|
{% endfor %}
|
||||||
<label class="col-sm-2 control-label">{{ field.label }}</label>
|
<label class="col-sm-2 control-label">{{ field.label }}</label>
|
||||||
<div class="col-sm-offset-2 col-sm-8">
|
<div class="col-sm-offset-2 col-sm-8 field-{{ field.html_name }}">
|
||||||
<input type="{{ field.type }}" name="{{ field.name }}" class="form-control {{ field.classes }}" />
|
<input type="{{ field.field.widget.input_type }}" name="{{ field.html_name }}" class="form-control {{ field.classes }}" />
|
||||||
{% if field.errors %}
|
{% if field.errors %}
|
||||||
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Reference in New Issue