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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -