Add bootstrap styling to login page

This commit is contained in:
Adam Goldsmith 2020-12-15 14:16:10 -05:00
parent 09bc22f60b
commit 365c97d0ef

View File

@ -1,34 +1,36 @@
{% extends "base.djhtml" %} {% extends "base.djhtml" %}
{% load widget_tweaks %}
{% block title %} Login {% endblock %} {% block title %} Login {% endblock %}
{% block content %} {% block content %}
{% if form.errors %} {% if form.errors %}
<p>Your username and password didn't match. Please try again.</p> <p class="alert alert-danger">Your username and password didn't match. Please try again.</p>
{% endif %} {% endif %}
{% if next %} {% if next %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed, <p class="alert alert-danger">
please login with an account that has access.</p> Your account doesn't have access to this page. To proceed,
please login with an account that has access.
</p>
{% else %} {% else %}
<p>Please login to see this page.</p> <p class="alert alert-info">Please login to see this page.</p>
{% endif %} {% endif %}
{% endif %} {% endif %}
<form class="d-flex flex-column align-items-center p-4" method="post" action="{% url 'login' %}"> <form class="d-flex flex-column align-items-center" method="post" action="{% url 'login' %}">
{% csrf_token %} {% csrf_token %}
<table> {% for field in form %}
<tr> <div class="form-group row">
<td>{{ form.username.label_tag }}</td> <label class="col-sm-4 col-form-label" for="{{ field.auto_id }}">{{ field.label }}</label>
<td>{{ form.username }}</td> <div class="col-sm-8">
</tr> {% render_field field class="form-control" %}
<tr> </div>
<td>{{ form.password.label_tag }}</td> </div>
<td>{{ form.password }}</td> {% endfor %}
</tr> <input type="submit" class="btn btn-primary" value="login" />
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" /> <input type="hidden" name="next" value="{{ next }}" />
</form> </form>