开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜