Django文本字段的安全过滤器会影响按钮标签

2024-09-27 00:14:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用安全过滤器来允许嵌入的html标记工作,但它会影响它下面的按钮。我试着把逃生过滤器和保险箱结合使用,但似乎什么都没用

    <p class="card-text"> {{ post.text | truncatewords:200 | safe | escape}} </p>
    <a href="{% url 'detail_post' post.id %}" class="btn btn-primary"> Read More &rarr; </a> 

结果如下: enter image description here

什么时候应该是:enter image description here


Tags: text标记url过滤器htmlcardpost按钮

热门问题