Use POST for logout, as GET is deprecated as of Django 4.1

This commit is contained in:
Adam Goldsmith 2022-09-03 00:38:44 -04:00
parent 1127978e10
commit 928886eb4e

View File

@ -34,7 +34,10 @@
href="{% block admin_link %}{% url 'admin:index' %}{% endblock %}">Admin</a>
{% endif %}
{% if user.is_authenticated %}
<a class="nav-item nav-link" href="{% url 'logout' %}">Logout: {{ user }}</a>
<form method="post" action="{% url 'logout' %}">
{% csrf_token %}
<button class="btn" type="submit">Logout: {{ user }}</button>
</form>
{% else %}
<a class="nav-item nav-link"
href="{% url 'login' %}?next={{ request.get_full_path }}">Login</a>