Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6854107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:35:34+00:00 2026-05-27T01:35:34+00:00

I want to hold information about a users preferences in a session variable. If

  • 0

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 to be maintained without needing to reselect it.

Django sessions maintain a session key in a cookie to track a users session. The way I understand it, this key is changed when a user logs in.

a) Does this mean all session variables are deleted on login or is there any sort of passover

b) In the case of not being able to save preferences across a login, is manually setting cookies the best way to proceed? I imagine a scenario like:

  • while logged out, maintain preferences in cookie
  • on login, copy preferences to session variable and write to db (via signal?)
  • on logout, update cookies with preferences (via signal?)

Update

I managed to get this functionality by saving preferences in the User’s profile object, as well as in a cookie (these preferences are not sensitive in any way). When the user is logged in, their profile setting takes preference. When not logged in, the cookie preference is chosen

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:35:34+00:00Added an answer on May 27, 2026 at 1:35 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a normalization thing, but I want I have to hold information about
I'm using a field in a table to hold information about varios checkboxes (60).
I have made a small SQL database to hold some information about students. I
I want to hold a bunch of const char pointers into an std::set container
I want to hold reference to object so it doesn't get deleted in bind
I want to get hold of the mouse position in a timeout callback. As
I want to create a vb.net project that I will use to only hold
I have an ArrayList that I want to use to hold RaceCar objects that
I have a Dictionary where I hold data for movieclips, and I want the
I am new to iPhone development. I want a Nsmutable array to hold numbers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.