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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -