Opened 15 years ago

Closed 9 years ago

#12405 closed New feature (fixed)

django.contrib.auth.views.logout() should support LOGOUT_REDIRECT_URL

Reported by: Cory Walker Owned by: Hugo Osvaldo Barrera
Component: contrib.auth Version: 1.1
Severity: Normal Keywords: logout LOGOUT_REDIRECT_URL
Cc: mike@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I was wondering why django.contrib.auth.views.logout() doesn't support a REDIRECT_URL override in the settings file as login() does. I'm aware that it is possible to specify a next_page argument, however, this is cumbersome if the urls.py containing logout() is a third party library such as django-registration. I haven't taken a good look at the source, but I am guessing this would be a simple patch to write in order to support LOGOUT_REDIRECT_URL. Before I work on it, I need to know if there are any possible regressions or if there are any opinions against this.

Change History (19)

in reply to:  description comment:1 by Dan Loewenherz, 15 years ago

Owner: changed from nobody to Dan Loewenherz
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 by Dan Loewenherz, 15 years ago

Needs documentation: set
Needs tests: set

comment:3 by Cory Walker, 15 years ago

dloewenherz: are you a triager giving me the go-ahead for writing a patch like this, or are you claiming the bug yourself? Either way, I'm still interested in seeing this patch hopefully make it into trunk.

comment:4 by Dan Loewenherz, 15 years ago

I'm claiming it, although I wouldn't exactly call it a bug ;).

Did you already have a patch?

comment:5 by Cory Walker, 15 years ago

I don't have a patch, I was just making sure you were claiming it. If you end up not being able to work on it, I could if I have time.

comment:6 by anonymous, 14 years ago

Please see ticket #11223.

comment:7 by Matt McClanahan, 14 years ago

Severity: Normal
Type: New feature

comment:8 by Mike Fogel, 14 years ago

Cc: mike@… added

comment:9 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:10 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:11 by bigkevmcd, 11 years ago

Owner: changed from Dan Loewenherz to bigkevmcd

comment:12 by anonymous, 10 years ago

So? What's the status?

comment:13 by anonymous, 10 years ago

Owner: bigkevmcd removed
Status: assignednew

comment:14 by Christian Barcenas, 10 years ago

Owner: set to Christian Barcenas
Status: newassigned

comment:15 by Christian Barcenas, 10 years ago

Picking this one up as my first contribution to Django :) I don't anticipate this taking more than a few lines of code and a test or two.

https://github.com/cbarcenas/django/tree/ticket_12405

Last edited 10 years ago by Christian Barcenas (previous) (diff)

comment:16 by Hugo Osvaldo Barrera, 9 years ago

I've implemented a PR for this, based on changes that implemented this on a specific project:

https://github.com/django/django/pull/5193

Let me know if there's anything that need tweaking.

comment:17 by Tim Graham, 9 years ago

Has patch: set
Needs documentation: unset

Tests are missing. Please uncheck "Needs tests" on the ticket when you update it so the ticket appears in the review queue, thanks!

comment:18 by Hugo Osvaldo Barrera, 9 years ago

Needs tests: unset
Owner: changed from Christian Barcenas to Hugo Osvaldo Barrera

comment:19 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In dcee1dfc:

Fixed #12405 -- Added LOGOUT_REDIRECT_URL setting.

After a user logs out via auth.views.logout(), they're redirected
to LOGOUT_REDIRECT_URL if no next_page argument is provided.

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