[Django]-Some values are null in my render_to_response dictionary

2👍

The problem is not what you think it is. It is simply that True and False are not automatically present in the template context, so (as with any other nonexistent template variables) they default to None, and your comparisons fail.

However there is no reason to be explicitly comparing with those values anyway. As with Python code, you should simply do a boolean test:

{% if isolate_location %}
    ...
{% endif %}
{% if not show_request_list %}
    ...
{% elif show_request_list %}
    ...
{% endif %}

Leave a comment