Session reset by django-all auth

I use django all auth to login to my site. I want to pass some session variables from one view to another, but when I go to the login page through allauth, my session variable is somehow reset. Is a session destroyed when I go to the login page? If so, how do you pass variables from one view to another?

view1

request.session['redirect-url'] = request.get_full_path() path = request.session['redirect-url'] 

view2 (in view mode)

  session_url = request.session.get('redirect-url' , None) if session_url: success_url = session_url del request.session['redirect-url'] 

I also check this session variable on other pages of my site and it passes correctly. But there is a reset when I got to my login page. Why?

I checked the login view and there is no explicit statement that clears the session variable.

+4
source share
1 answer

Because you define del in your browser. del clears the session variable.

 session_url = resquest.session.get('redirect-url' , None) if session_url: success_url = session_url 
0
source

Source: https://habr.com/ru/post/1389925/


All Articles