Skip to content

Commit 9b883cb

Browse files
committed
Use POST for logout button
Django 5 requires this.
1 parent a00a76c commit 9b883cb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

econplayground/templates/base.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,19 @@
113113
<li class="nav-item">
114114
{% if request.user.is_anonymous %}
115115
<a class="nav-link" title="Log In" href="/accounts/login"><span title="Log In">Log In</span></a>
116-
{% else %}
117-
<a class="nav-link" title="Log Out" href="/accounts/logout/?next=/"><span title="Log Out">
116+
{% else %}
117+
<form action="{% url 'logout' %}" method="post">
118+
{% csrf_token %}
119+
<button type="submit" class="nav-link" title="Log Out">
120+
<span title="Log Out">
118121
{% if user.first_name %}
119122
{{user.first_name}}
120123
{% else %}
121124
{{user.username}}
122125
{% endif %}
123-
| Log Out</span></a>
126+
| Log Out</span>
127+
</button>
128+
</form>
124129
{% endif %}
125130
</li>
126131
</ul>

0 commit comments

Comments
 (0)