Reputation: 803
I am using Django flatpages and would like to implement some logic in a template based on a user session variable.
eg.
{% if session.my_var %}
YES
{% else %}
NO
{% endif %}
Problem is that session object is not defined in flatpage context.
Upvotes: 0
Views: 561
Reputation: 122376
Create a TEMPLATE_CONTEXT_PROCESSOR
which is then used by the RequestContext
(see docs).
def session(request):
return { 'session': request.session }
Upvotes: 1