【发布时间】:2015-04-08 10:25:56
【问题描述】:
如果我输入 django template.html 这个代码
<p>{% if some_custom_template %} {%some_custom_template%} {% else %} nothing {% endif %}</p>
some_custom_template 会执行两次吗?还是some_custom_template结果被缓冲了?
如果some_custom_template 被执行两次,我如何将第一个结果保存在一些模板变量中?
【问题讨论】:
-
在测试用例中,
some_custom_template就是return 5。在生产中,它是一个 db-query
标签: django-templates django-custom-tags