简体   繁体   English

带有HTML的DjangoCMS render_model

[英]DjangoCMS render_model with HTML

I'm using Django CMS and the Aldryn News Blog app on a client site to display a blog listing. 我在客户端站点上使用Django CMS和Aldryn News Blog应用程序来显示博客列表。 The default template code uses 默认模板代码使用

{% render_model article "lead_in" %}

to display the "Lead in" excerpt text. 以显示“导入”摘录文本。 However it is displaying p tags for me and I actually need them to render. 但是它正在为我显示p标签,我实际上需要它们进行渲染。

https://pasteboard.co/GSq8XObQ.png https://pasteboard.co/GSq8ONF.png https://pasteboard.co/GSq8XObQ.png https://pasteboard.co/GSq8ONF.png

I have tried both: 我都尝试过:

{% autoescape off %}
{% render_model article "lead_in" %}
{% endautoescape %}



{% render_model article "lead_in" |safe %}

The first does nothing and the second errors out. 第一个什么都不做,第二个错误。 How can I get it to render the html tags? 我如何获得它呈现html标签?

您是否尝试过此解决方案?

{{ article.lead_in|safe }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM