Reputation: 97
Say I have two pages one is example.com/login and another page is example.com/admin
And when I put the credentials on the login page I get redirected to the admin page.
Admin page has a logout button. If I press that button then it redirects me to the login page again.
What I exactly want to do is, I want to display a message "Login again" dynamically (I know how to display a message dynamically) but only when user gets redirected from the login page via admin panel.
How can I do that?
Upvotes: 0
Views: 125
Reputation: 742
You can do that either by:
logout(request)
request.session['logged_out'] = True
redirect('login/?logged-out=True')
in both cases you have to check in your view, and add a a property to check with in your context.
Upvotes: 1