Skip to content

Method Not Allowed (GET): /admin/logout/ #2071

Answered by molokov
adhibtaAtFb asked this question in Q&A
Discussion options

You must be logged in to vote

In Django 5.0, they removed the ability to log out via a simple link (i.e. the GET method), see https://docs.djangoproject.com/en/5.0/releases/5.0/#features-removed-in-5-0

A solution is to change the logout link to a form in your template, for example:

<form action="{% url 'logout' %}" method="post">
  {% csrf_token %}
  <button type="submit">Log Out</button>
</form>

Or, if you still want it formatted as an anchor link (assumes jQuery):

<a href="#" onclick="$('#logoutform').submit()">Log Out</a>
<form id="logoutform" method="post" action="{% url 'logout' %}">
        {% csrf_token %}
        <input type="hidden">
 </form>

Given that Django 5.0 support in Mezzanine isn't official as yet,…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@adhibtaAtFb
Comment options

Answer selected by adhibtaAtFb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants