On Mon, 2008-12-15 at 14:37 -0800, redbaron wrote:
> quote from official docs about logout_then_login view: "login_url: The
> URL of the login page to redirect to. This will default to
> settings.LOGIN_URL if not supplied"
> How to supply alternative login_url?
If you look at the function signature for logout_then_login(), in
django/contrib/auth/views.py, you'll see that it accepts a login_url
parameter.
>
> I add logout url to urls.py:
> url(r'^accounts/logout/
> $','django.contrib.auth.views.logout_then_login',name='logout'),
>
> Then I'd like to redirect user to my custom page after logout succeed,
> how could I do that?
> {% url logout login_url="/my/custom/path" %} doesn't do the job, I
> catch error in reverse function.
The parameters passed via the "url" template tag are parameters that are
captured by the regular expression for that URL pattern. Your pattern,
in this case, is "accounts/logout/", which has no variable pieces --
that is, the reg-ex has no capturing groups. That's a good thing, since
it's not really something the user is ever going to control -- there's
precisely one way to logout.
However, if you want to pass some extra information to the
logout_then_login function, look at the third argument in the url() call
-- the dictionary of extra parameters. You can set up the login_url
parameter there.
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---