Opened 9 years ago

Closed 9 years ago

Last modified 9 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: UI/UX:


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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 9 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 9 years ago by ubernostrum

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