Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#20447 closed New feature (fixed)

next_page parameter in logout function does not recognize named urls

Reported by: caumons Owned by: Baptiste Mispelon
Component: contrib.auth Version: 1.5
Severity: Normal Keywords:
Cc: bmispelon@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using logout function:

logout(request[, next_page, template_name, redirect_field_name])

next_page parameter does not recognize named urls, it appends the name at the end of the current URL. E.g. if your "/" URL is named "home", then using "home" as the next_page will result in the URL /logout/home

If this won't be fixed, at least mention it in the docs. Thanks!

Change History (5)

comment:1 by svisser, 12 years ago

Triage Stage: UnreviewedAccepted

This seems fair.The corresponding login view does call resolve_url to lookup a variety of ways to express the URL but the logout view does not.

Either we need to make things consistent or we need to mention it in the documentation.

comment:2 by Baptiste Mispelon, 12 years ago

Cc: bmispelon@… added
Owner: changed from nobody to Baptiste Mispelon
Status: newassigned
Type: BugNew feature

The login and logout views don't actually work exactly the same way. You can't pass a next_page parameter to login (you can configure settings.LOGIN_REDIRECT_URL or pass a parameter in the request).

Still, this seems like a reasonable and useful feature, which wouldn't be hard to implement. I don't foresee any backwards-compatibility issues either.

comment:3 by Baptiste Mispelon, 12 years ago

Has patch: set

comment:4 by Marc Tamlyn <marc.tamlyn@…>, 12 years ago

Resolution: fixed
Status: assignedclosed

In 980ae2ab29cb25182404eb1ccc919573edcc44f5:

Fix #20447: URL names given to contrib.auth.views are now resolved.

This commit also adds tests for the redirect feature of most auth views.
It also cleans up the tests, most notably using @override_settings instead
of ad-hoc setUp/tearDown methods.

Thanks to caumons for the report.

Conflicts:

docs/releases/1.6.txt

comment:5 by caumons, 12 years ago

Thanks to you for the fast fix!

I installed Django with pip command. Can I get this update into the current installed version or should I use a clone of the development version?

Thanks! :)

Last edited 12 years ago by caumons (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top