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