DjangoCMS render_model 和 HTML
DjangoCMS render_model with HTML
我在客户端站点上使用 Django CMS 和 Aldryn 新闻博客应用程序来显示博客列表。默认模板代码使用
{% render_model article "lead_in" %}
显示 "Lead in" 摘录文本。但是它正在为我显示 p 标签,我实际上需要它们来呈现。
https://pasteboard.co/GSq8XObQ.png
https://pasteboard.co/GSq8ONF.png
我都试过了:
{% autoescape off %}
{% render_model article "lead_in" %}
{% endautoescape %}
{% render_model article "lead_in" |safe %}
第一个什么都不做,第二个出错。我怎样才能让它呈现 html 标签?
您尝试过这个解决方案吗?
{{ article.lead_in|safe }}
我在客户端站点上使用 Django CMS 和 Aldryn 新闻博客应用程序来显示博客列表。默认模板代码使用
{% render_model article "lead_in" %}
显示 "Lead in" 摘录文本。但是它正在为我显示 p 标签,我实际上需要它们来呈现。
https://pasteboard.co/GSq8XObQ.png https://pasteboard.co/GSq8ONF.png
我都试过了:
{% autoescape off %}
{% render_model article "lead_in" %}
{% endautoescape %}
{% render_model article "lead_in" |safe %}
第一个什么都不做,第二个出错。我怎样才能让它呈现 html 标签?
您尝试过这个解决方案吗?
{{ article.lead_in|safe }}