How to save result of the comparison with Django ‘with’ template tag?

I would like to create new variable in django template, which will have a value of comparison obj.site.profile.default_role==obj

Unfortunately none of these code doesn’t work:

{% with obj.site.profile.default_role==obj as default %}{% endwith %}

{% with default=obj.site.profile.default_role==obj %}{% endwith %}

What is the proper syntax?


Source: python

Leave a Reply