]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
views: Switch logout to POST stable/3.2
authorStephen Finucane <stephen@that.guru>
Fri, 1 Nov 2024 15:45:03 +0000 (15:45 +0000)
committerStephen Finucane <stephen@that.guru>
Fri, 1 Nov 2024 15:47:01 +0000 (15:47 +0000)
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 <stephen@that.guru>
(cherry picked from commit 45f47e96c6c90aefac37b02e0e15052f6ba41a90)

htdocs/css/style.css
templates/base.html

index 1a739510924c6c84ce2f1dacf9cb0d97e7364165..c4025c0505d62ced83062ae29ed7a2402a3c3514 100644 (file)
@@ -56,6 +56,34 @@ pre {
     color: #999;
 }
 
+ul.dropdown-menu > li > form {
+    display: block;
+    width: 100%;
+}
+
+ul.dropdown-menu > li > form > button {
+    /* taken from bootstrap's styling for '.dropdown-menu > li > a' */
+    background: none;
+    border: none;
+    cursor: pointer;
+    display: block;
+    padding: 3px 20px;
+    clear: both;
+    font-weight: 400;
+    line-height: 1.42857143;
+    color: #333;
+    white-space: nowrap;
+    width: 100%;
+    text-align: left;
+}
+
+ul.dropdown-menu > li > form > button:hover {
+    /* taken from bootstrap's styling for '.dropdown-menu > li > a:hover' */
+    color: #262626;
+    text-decoration: none;
+    background-color: #f5f5f5;
+}
+
 form {
     padding: 0em;
     margin: 0em;
index 747da592267cbfc2db78415307f4de5748e1a72e..9519ecc5511111596f54849eab0e9a8bf6905bd8 100644 (file)
                 <li><a href="{% url 'admin:index' %}">Administration</a></li>
 {% endif %}
                 <li><a href="{% url 'user-profile' %}">View profile</a></li>
-                <li><a href="{% url 'auth_logout' %}">Logout</a></li>
+                <li>
+                  <form id="logout-form" method="post" action="{% url 'auth_logout' %}">
+                    {% csrf_token %}
+                    <button type="submit">Logout</button>
+                  </form>
+                </li>
               </ul>
             </li>
 {% else %}