【发布时间】:2019-07-13 18:24:30
【问题描述】:
我正在尝试将换行符构建到字符串中,然后在带有换行符的模板中呈现该字符串。我将以下字符串保存到模型字段:
usercart.other_tax_regnum = "State tax reg number" + "/n" + "Second State tax reg number"
usercart.save()
然后,在我看来,我渲染了该字段
{{ usercart.other_tax_regnum|linebreaks }}
这不是显示换行符,而是呈现的内容:
State tax reg number/nSecond State tax reg number
有什么想法可以做到这一点吗?
谢谢!
【问题讨论】:
标签: django