On Dec 18, 9:43 pm, Continuation <selforgani...@gmail.com> wrote:
> I tried
>
> {% if field %}
>    No
> {% else %}
>   Yes - {{ field }}
> {% endif %}
>
> And if the value of field is null, the else statement above ended up
> getting executed and output was "Yes - None"
>
> So far for me:
>
> {% ifequal field Null %} and {% ifequal field None %} works.
>
> But
>
> {% if field %}
>
> doesn't.
>
> Did I do something wrong?

You had it the wrong way round. {% if field %} tests whether the field
is *not* None or 0 or '' or []. So swap the Yes and No branches.
--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to