D
D
Dauren S2016-07-28 11:16:42
Django
Dauren S, 2016-07-28 11:16:42

How to check session and value in django template?

I want to check in the template whether there is a session with a key or not. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2016-07-28
@dauren101

{% if request.session.key_name %}
    ...
{% endif %}

S
sim3x, 2016-07-28
@sim3x

This is not done in the template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question