python - How to save result of the comparison with Django 'with' template tag? -
i create new variable in django template, have value of comparison obj.site.profile.default_role==obj
unfortunately none of these code doesn't work:
{% obj.site.profile.default_role==obj default %}{% endwith %} {% default=obj.site.profile.default_role==obj %}{% endwith %}
what proper syntax?
with
tag have no support value evaluation.
the possible template-only solution can imaging split part of html sub-template , use {% include %}
tag
{% if obj.site.profile.default_role==obj %} {% include 'subtemplate.html' default=true %} {% else %} {% include 'subtemplate.html' default=false %} {% endif %}
Comments
Post a Comment