[Answer]-Default boolean to something that isn't falsey in Django template

1👍

I don’t see it as a filter but in the template language logic you can use ‘==’ which equates to ‘===’ or ‘is’ in python and does not match None or ” to False the way that using ‘not’ does.

{% if something.boolean_val == False %}plain{% else %}bold{% endif %}
👤Renoc

Leave a comment