开发者

Check if a session variable is set

开发者 https://www.devze.com 2022-12-12 09:52 出处:网络
I\'d like to check if a certain variable is set inside my template...if it is set, an image will be displayed...I have written this as below in my template, but apparently it\'s not working.

I'd like to check if a certain variable is set inside my template...if it is set, an image will be displayed...I have written this as below in my template, but apparently it's not working.

{% if request.session.chosen_year %}
    <a href="/undo_year/">
       <img src="{{ MEDIA_URL }}img/undo.gif" border="0" alt="Reset" /&g开发者_如何学运维t;
    </a>
{% endif %}

What have I missed?


Are you using a RequestContext so that the request is passed into the template context?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号