Check if a variable is defined in django templating language [closed]
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am using django 1.5, I need to check if a variable is defined (and have it not work if the variable is defined but None, 0, "", etc...). Something like: {% ifexists a_variable %} <p> Hey the variable exists </p> {% endifexists %} I don't how best to do this... Please read the documentation . The {% if %} tag evaluates a variable, and if that variable is “true” (i.e. exists ... {% if athlete_list %} Number of