我有这个观点
def terms(request):
d = getVariables(request,dictionary={'page_name': "Jack's Terms of Service"})
return render(request, 'jack/terms.html', d)
我将其渲染为模板中的页面标题
<title>{{ page_name }}</title>
但是由于某种原因,它会像这样打印page_名称
<title>Jack's Terms of Service</title>
我不知道为什么它不在字符串中打印撇号。
使用安全。它将字符串标记为不需要在输出之前进一步转义HTML。
<title>{{ page_name|safe }}</title>
此处的文档:https : //docs.djangoproject.com/en/dev/ref/templates/builtins/#safe
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句