PacktPublishing / Django-4-by-example

Django 4 by example (4th Edition) published by Packt
https://djangobyexample.com/
MIT License
818 stars 461 forks source link

Ch.4 logout page generates http 405 error #62

Open Marforio opened 8 months ago

Marforio commented 8 months ago

In templates/base.html, the use of an <a> hypertext element when calling authviews.LogoutView is causing an http 405 error because a GET request to LogoutView is being sent. LogoutView expects POST.

Why did you guys use the hypertext link to activate LogoutView?

talhaanwarch commented 7 months ago

Look like thats true, i also could not figure it out that they had created a logged_out.html page and in code i also could not figure out the piece of code that tells to redirect to this page when user click on logout button

Btw in django 4, it work. In django 5


Support for logging out via GET requests in the django.contrib.auth.views.LogoutView and django.contrib.auth.views.logout_then_login() is removed.`
``
Marforio commented 7 months ago

very interesting and helpful, thanks for the feedback!