Hi, You should be able to access the website without logging in? Or do you mean that the user has access to protected pages?
If you have added the login_required decorator ( https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-login-required-decorator) on your view functions that shouldn't be possible. However the cached version of the page should still be accessible (by clicking back). That is per design (the client side caches the page). You can prevent this by using cache decorators: http://stackoverflow.com/questions/6923027/disable-browser-back-button-after-logout Regards, Andréas 2015-10-14 11:07 GMT+02:00 palansh agarwal <palanshagar...@gmail.com>: > Hi, > > I am trying to implement logout for users in my app. My problem is : When > a user logs out and clicks back button in browser he is able to access the > website again without logging in. > > My current code for logout function is--> > > def logout_user(request): >> del request.session['userid'] >> logout(request) >> return render_to_response('index.html') >> > > Any help will be appreciated. > > Regards, > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/183577c1-57b8-47be-9308-19205cb11bd9%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/183577c1-57b8-47be-9308-19205cb11bd9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALXYUbn5UdQUfU%2BWpt_-_iQLRreHvre_EPkoHnu75oA6y8pjjA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.