Add Logout button

This commit is contained in:
Lucas Schumacher 2024-06-28 14:26:30 -04:00
parent 989da8396e
commit 5f8fe95ef1
2 changed files with 6 additions and 1 deletions

View File

@ -122,4 +122,5 @@ STATIC_URL = 'static/'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGIN_REDIRECT_URL = "/"
LOGIN_REDIRECT_URL = "home"
LOGOUT_REDIRECT_URL = "home"

View File

@ -5,6 +5,10 @@
{% block content %}
{% if user.is_authenticated %}
Hi {{ user.username }}!
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Log out</button>
</form>
{% else %}
<p>You are not logged in</p>
<a href="{% url 'login' %}">Log In</a>