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

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -