Django: accessing session variables from within a template?
Posted
by AP257
on Stack Overflow
See other posts from Stack Overflow
or by AP257
Published on 2010-03-31T10:03:20Z
Indexed on
2010/03/31
10:13 UTC
Read the original article
Hit count: 309
django
Hi all
If I set a session variable in Django, like:
request.session["name"] = "name"
Is there a way I can access it from within a template, or do I have to retrieve it from within a view, and then pass it to a template?
Asking because I have around 10 little session variables that I'd like to access within a template, and passing all 10 from the view to the template could get a bit messy.
(I have to use session variables because it's a HttpResponseRedirect, but storing the variables in a database is overkill for my purposes.)
So - any way to grab session variables directly within a template?
© Stack Overflow or respective owner