Persisting session variables across login

后端 未结 5 1187
名媛妹妹
名媛妹妹 2020-12-30 16:01

I want to hold information about a users preferences in a session variable. If the user chooses a preference while logged out and then later logs in, I want the preference t

5条回答
  •  悲哀的现实
    2020-12-30 16:23

    When you login/logout Django will flush all sessions if another user logs in (request.session.flush() in auth/init.py).

    You're better of storing user settings in the database and add some middleware to get that data and store it in your request.

提交回复
热议问题