Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4259 closed (invalid)

Using sessions out of views Is Incomplete / Unusable

Reported by: pkenjora@… Owned by: Jacob
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The example does not address how to get the session_key for the session from which the tag is being called. This component is critical yet missing. Would make the docs much better if the example included how to get the session_key ourside a view. Sorry couldnt figure it out otherwise I would have added a solution.

Change History (3)

comment:1 Changed 12 years ago by Gary Wilson <gary.wilson@…>

Resolution: invalid
Status: newclosed

Not exactly sure what you mean by getting the session key for the session from which the tag is being called. Could you please explain.

comment:2 Changed 12 years ago by Simon G. <dev@…>

If you want to get the session ID in a view, then if SessionMiddleware is enabled, then you can look inside request.session for the key (session_key), and then query the Session table for the information. See Session Docs for more info.

comment:3 Changed 12 years ago by James Bennett

I assume you're talking about doing this in a template tag; template tags have access to the template context, and if you add django.core.context_processors.request to your TEMPLATE_CONTEXT_PROCESSORS setting, the request (and therefore request.session will be available in the context.

Note: See TracTickets for help on using tickets.
Back to Top