in this case I'm using jinja macro
{%- macro ifElseBoolTemplate(variable, trueValue="", falseValue="") -%}
{%- if variable -%}{{ trueValue }}{%- else -%}{{ falseValue }}{%- endif %}
{%- endmacro %}
(macro saved at file : macro/formMacro.html)
{% import 'macro/formMacro.html' as formTag with context %}
...
<div class="item {{ formTag.ifElseBoolTemplate(item.isActive, "", "inactive") }}" >sample content</div>
that's it
No comments:
Post a Comment