|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Django has anonymous sessions, tracked by cookies. The session can not be accessed from a different machine for the same user, which drastically reduces the usefulness of sessions. Another approach to save something persistently for a user it to update the UserProfile model and create a new row for the same, but this will require altering the corresponding table every time we realize we have one more thing to save.
What I am proposing is this: we update the User model, and add a "session_data = models.TextField(_('session data'))" to it. Additionally in User.init we add a "self.session = SessionWrapper('user:%s' % self.id)". We will have to add a .save() method on django.contrib.sessions.middleware.SessionWrapper, and optionally update django.contrib.sessions.middleware.SessionMiddleware.process_response to call request.user.session.save() if request.user.session.modified is true.
Change History (8)
comment:1 follow-up: 3 Changed 10 years ago by
|Patch needs improvement:||unset|