Saturday, May 27, 2023
HomeQ&AAfter logout clicking, the back button page is open in Django why?

After logout clicking, the back button page is open in Django why?

This is actully a cache problem.

You can use cache_control decorator to force no cache on views

from django.views.decorators.cache import cache_control

@cache_control(no_cache=True, must_revalidate=True)
def func()
  #some code
  return

This will force the browser to make request to server.

You should also write your own decorator that replaces @login_required so that you don’t need to use both on every page.

Rahul K Raj
Rahul K Rajhttps://rkrknowledge.com/
Hi 👋, I'm Rahul Raj Kushwaha also known as Rahul K Raj. A passionate full-Stack developer from India. You can call me: Entrepreneur | Youtuber | Blogger | Coder | Developer | UI Designer | Hacker | Music Composer. I like to share my knowledge on such great platforms like RKR Knowledge. I try to learn something new every day.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Stay Connected

33FansLike
60FollowersFollow
520SubscribersSubscribe

Most Popular

Recent Comments