How to insert return value from templatetag to {% if
I have templatetag:
@register.simple_tag
def开发者_运维知识库 get_something(data, var1, var2):
if data:
if var1:
if var2:
return True
return False
And ho to insert this to {% if ... %} block? This is not working:
{% if get_something 1 1 0 %}
You can't. Have your tag set a variable in the context, and use that variable instead.
精彩评论