Skip to content

Commit 5b5fef5

Browse files
committed
views: Switch logout to POST
This was deprecated in 4.1 and removed in 5.0. I missed it. [1] https://docs.djangoproject.com/en/5.0/releases/4.1/#features-deprecated-in-4-1 Signed-off-by: Stephen Finucane <[email protected]> (cherry picked from commit 45f47e9)
1 parent 794bdb9 commit 5b5fef5

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

htdocs/css/style.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,34 @@ pre {
5656
color: #999;
5757
}
5858

59+
ul.dropdown-menu > li > form {
60+
display: block;
61+
width: 100%;
62+
}
63+
64+
ul.dropdown-menu > li > form > button {
65+
/* taken from bootstrap's styling for '.dropdown-menu > li > a' */
66+
background: none;
67+
border: none;
68+
cursor: pointer;
69+
display: block;
70+
padding: 3px 20px;
71+
clear: both;
72+
font-weight: 400;
73+
line-height: 1.42857143;
74+
color: #333;
75+
white-space: nowrap;
76+
width: 100%;
77+
text-align: left;
78+
}
79+
80+
ul.dropdown-menu > li > form > button:hover {
81+
/* taken from bootstrap's styling for '.dropdown-menu > li > a:hover' */
82+
color: #262626;
83+
text-decoration: none;
84+
background-color: #f5f5f5;
85+
}
86+
5987
form {
6088
padding: 0em;
6189
margin: 0em;

templates/base.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@
9393
<li><a href="{% url 'admin:index' %}">Administration</a></li>
9494
{% endif %}
9595
<li><a href="{% url 'user-profile' %}">View profile</a></li>
96-
<li><a href="{% url 'auth_logout' %}">Logout</a></li>
96+
<li>
97+
<form id="logout-form" method="post" action="{% url 'auth_logout' %}">
98+
{% csrf_token %}
99+
<button type="submit">Logout</button>
100+
</form>
101+
</li>
97102
</ul>
98103
</li>
99104
{% else %}

0 commit comments

Comments
 (0)