Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4259 closed (invalid)

Using sessions out of views Is Incomplete / Unusable

Reported by: pkenjora@… Owned by: Jacob
Component: Documentation Version: dev
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

Description

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 by Gary Wilson <gary.wilson@…>, 17 years ago

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 by Simon G. <dev@…>, 17 years ago

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 by James Bennett, 17 years ago

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