【问题标题】:Display text from CKEditor from SQLalchemy in HTML在 HTML 中显示来自 SQLalchemy 的 CKEditor 的文本
【发布时间】:2022-01-29 15:50:50
【问题描述】:

我以烧瓶形式使用 CKEditor 并使用 SQLAlchemy 保存数据,当我尝试使用 Jinja2 显示带有 HTML 的文本时。它不显示为输入。

这是代码(假设是文本格式,但看起来像源代码):

<p>Emailed <strong>user first strike,</strong> <a href="http://www.google.co.in">awaiting user&#39;s reply</a>.</p>
<p>Emailed user second strike, awaiting user&#39;s reply.</p><p><strong>Emailed user-third strike, will be closing the case by the end of tomorrow&#39;s working hours.</strong></p>

这是预期的结果:

已通过电子邮件发送用户第一击, awaiting user's reply

已通过电子邮件发送用户第二次罢工,等待用户回复。

通过电子邮件发送的用户第三次罢工,将在明天的工作时间结束前结束此案。

【问题讨论】:

    标签: python html flask sqlalchemy ckeditor


    【解决方案1】:

    在 html 中添加 |safe 以呈现 html 中的文本。 例子: {{ column.description|safe }}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-07-27
      • 2016-08-18
      • 1970-01-01
      • 2017-10-25
      • 1970-01-01
      • 2011-05-07
      • 2013-04-05
      相关资源
      最近更新 更多