【发布时间】:2016-07-02 00:33:00
【问题描述】:
我是 django 的新手。我有一个 纯文本,其中包含许多段落,它们是在 django admin 中输入的。 这是痛苦的文字复制自互联网
示例输入
A mysterious landscape phenomenon known as fairy circles has been found in the Australian outback. The fairy circles are characterised by a hexagonal organisation of soil gaps between grass vegetation and seen in the landscape from above.
The beautiful sight cannot be spotted from ground level. Until now, fairy circles have only been documented in the arid landscape of Namibia, Africa.
示例输出:
A mysterious landscape phenomenon known as fairy circles has been found in the Australian outback. The fairy circles are characterised by a hexagonal organisation of soil gaps between grass vegetation and seen in the landscape from above.
The beautiful sight cannot be spotted from ground level. Until now, fairy circles have only been documented in the arid landscape of Namibia, Africa.
当我使用{{ posts.description|linebreaks }}时,它只会给我一个换行符(一个换行符)。在我的 chrome 控制台中,它应该是一个 <br />
但我想要 2 个换行符
我尝试使用{{ posts.description|linebreaks|linebreaks }},但没有帮助
我应该如何插入 2 个换行符(两个换行符)?
任何帮助表示赞赏..在此先感谢
【问题讨论】:
-
您可以在
posts.description中直接保存2个<br />(例如替换\n)并在模板中应用safe过滤器 -
感谢您的回复..您能否提供一个示例,以便于理解...
标签: python django django-filter