Saturday, 17 August 2013

Using django SessionStore without knowing key

Using django SessionStore without knowing key

I'm writing a django app that requires an object to be somewhat
persistent, at least for the purposes of a session. It is not view-based,
so I'm looking at SessionStore as the place to create, then retrieve it
from. However, SessionStore requires a session_key in order to retrieve
the object. My app need to use this persistent object from the save()
method of certain models, so I can't pass the session_id to the save()
function in all cases (e.g. when a model instance is created via the admin
site). Is it possible to access the 'current session' somehow in django,
without using either the request object, or knowing the session_key?

No comments:

Post a Comment