【问题标题】:Plus + Character disappears加号+字符消失
【发布时间】:2011-02-17 13:51:35
【问题描述】:

由于某种原因,当我渲染一个包含 + 号的模板时,它会消失,没有错误或任何东西都消失了。

我是这样渲染的

rc = RequestContext(request, template_context_dict)

html_content = smart_str(Template(updated_template_source).render(rc))

当我检查请求和 rc 时它仍然存在,但在渲染之后它就消失了。

谢谢

【问题讨论】:

  • 模板中包含 + 的部分是什么样的?
  • 你能发布一些我们可以运行的代码来调试它吗?

标签: python django django-templates django-forms


【解决方案1】:

也许这与autoescape 有关。 可以试试

{% autoescape on %}
    {{ body }}
{% endautoescape %}

看看它是否仍然没有渲染。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-09
    • 1970-01-01
    • 1970-01-01
    • 2012-02-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多