bbrooke
bbrooke

Reputation: 2347

django redirect to home page after logging out

I'm trying to redirect to the home page after logging out by using django's logout_then_login function describe at https://docs.djangoproject.com/en/1.5/topics/auth/default/ but I think I'm not passing the url in correctly (I'm fairly new to django)

Any feedback is greatly appreciated.

Homepage URL

url(r'^$', 'myfitgames.views.home', name='home'),

Logout URL

url(r'^accounts/logout/$', 'django.contrib.auth.views.logout_then_login(request,"/")', name='logout'),

Upvotes: 1

Views: 1282

Answers (1)

falsetru
falsetru

Reputation: 369334

The second argument should be name of the view or a function.

Try following (Using a lambda as a function):

from django.contrib.auth.views import logout_then_login

url(r'^accounts/logout/$', lambda request: logout_then_login(request, "/"), name='logout'),

Upvotes: 2

Related Questions