我有一个模板,我正在插入包含标签:
{% include 'template.html' %}
同样在另一个地方,我希望其内容显示为原始内容。我怎样才能做到这一点?
最佳答案
您可以尝试以下操作:
页面1.html
{%with flag="norender" %}
{% include "template.html" %}
{%endwith%}
模板.html
{%if flag == "norender" %}
{%verbatim%}
{%endif%}
{#your html #}
{%if flag == "norender" %}
{%endverbatim%}
{%endif%}
关于django - 逐字包含模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17130803/