Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#35043 closed Bug (duplicate)

LogoutView.as_view() no longer works in 5.0

Reported by: otonoton Owned by: nobody
Component: HTTP handling Version: 5.0
Severity: Release blocker Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm having the same issue as #35013. I have in my urls.py:

path('logout/', auth_views.LogoutView.as_view()),

but since GET support was removed for LogoutView, this no longer works. Is this a regression, or what is the correct way to handle this?

Change History (5)

comment:1 by Mariusz Felisiak, 12 months ago

Resolution: duplicate
Status: newclosed

Duplicate of #35013.

Please don't open duplicates and check release notes.

comment:2 by otonoton, 12 months ago

I don't consider it a duplicate because URL path entries do not specify a request method. Please don't just immediately close my ticket without at least attempting to communicate with me first.

comment:3 by Mariusz Felisiak, 12 months ago

Please don't just immediately close my ticket without at least attempting to communicate with me first.

Then provide any details and follow our bug reporting guidelines. I don't think you've explained the issue in enough detail to confirm a bug in Django.

I don't consider it a duplicate because URL path entries do not specify a request method.

What do you mean? How could we understand what you're trying to report? The ticket description shows that it's a duplicate. LogoutView implements post() and release notes describe precisely that you should use POST requests.

comment:4 by otonoton, 12 months ago

How am I supposed to use LogoutView in urls.py now? i.e. without any other explicit view or template being defined (just like how it used to work)

I think there is not proper documentation of the possible subtle breakages of this change and surely it will affect many people who will be upgrading soon.

Last edited 12 months ago by otonoton (previous) (diff)

comment:5 by Tim Graham, 12 months ago

If you would like to continue supporting logout via GET, you could copy LogoutView from Django 4.2 and use that in your project.

Note: See TracTickets for help on using tickets.
Back to Top