move login formular to crispy

This commit is contained in:
Robert Einsle 2018-02-11 08:12:08 +01:00
parent 335e8ca4ff
commit e7dd1aa01a
2 changed files with 3 additions and 27 deletions

View File

@ -1,26 +0,0 @@
{% load form_tags widget_tweaks %}
{% if form.non_field_errors %}
<div class="alert alert-danger" role="alert">
{% for error in form.non_field_errors %}
<p{% if forloop.last %} class="mb-0"{% endif %}>{{ error }}</p>
{% endfor %}
</div>
{% endif %}
{% for field in form %}
<div class="form-group">
{{ field.label_tag }}
{% render_field field class=field|input_class %}
{% for error in field.errors %}
<div class="invalid-feedback">
{{ error }}
</div>
{% endfor %}
{% if field.help_text %}
<small class="form-text text-muted">
{{ field.help_text|safe }}
</small>
{% endif %}
</div>
{% endfor %}

View File

@ -1,5 +1,7 @@
{% extends '_base_accounts.html' %} {% extends '_base_accounts.html' %}
{% load crispy_forms_tags %}
{% block title %}login{% endblock %} {% block title %}login{% endblock %}
{% block content %} {% block content %}
@ -11,7 +13,7 @@
<form method="post" novalidate> <form method="post" novalidate>
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="next" value="{{ next }}"> <input type="hidden" name="next" value="{{ next }}">
{% include 'includes/form.html' %} {{ form|crispy }}
<button type="submit" class="btn btn-primary btn-block">Log in</button> <button type="submit" class="btn btn-primary btn-block">Log in</button>
</form> </form>
</div> </div>