views:

40

answers:

1

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" />
    </a>
{% endif %}

What have I missed?

+2  A: 

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

Daniel Roseman
this fixed it...thanks again Daniel. I have to keep remembering this...I always forget it
Stephen