【发布时间】:2021-07-27 12:54:37
【问题描述】:
我想做自定义通知系统。现在我在数据库中有表,有 html 代码,我放在我的页面上。 但是如果我在这段代码中插入 jinja 表达式,它们就会显示为纯文本。
例子:
def render():
hidden_variable = "world"
example = "Hello {{hidden_variable}}!"
return {'example': example, 'hidden_variable': hidden_variable}
模板.html
<div>
{{example}}
</div>
我得到了什么:
Hello {{hidden_variable}}!
我想要什么:
Hello world!
【问题讨论】:
-
这能回答你的问题吗? Jinja nested rendering on variable content