Django 注释删除新行
所以我一直在使用 Django 评论,我很高兴,但一位朋友指出,当他发布的内容较长且有新行时,Django 将它们删除了。
例如,如果我发布:
line1
line2
line3
那么它将被保存并显示为:
line1 line2 line3
有没有使用 Django 的人意识到这一点并弄清楚如何绕过 Django 取出新行?我在 Django 注释代码中进行了一些研究,但还没有发现任何可以被覆盖的内容。
谢谢
So I've been working with Django-comments and I'm pretty happy, but a friend pointed out that when he posted something that was longer and had new lines, Django took them out.
For example if I posted:
line1
line2
line3
Then it would be saved and displayed as:
line1 line2 line3
Has anyone using Django realized this and figured out how to get around Django taking out new lines? I've poked around a bit in Django-comments code but haven't found anything yet that could be overridden.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否看过
换行符
和linebreaksbr
过滤器?您可以使用get_comment_list
标签 来获取Comment
对象列表,然后您可以传递通过适当的过滤器的comment
属性。Have you looked at the
linebreaks
andlinebreaksbr
filters? Instead of using therender_comment_list
tag, you'd use theget_comment_list
tag to get a list ofComment
objects, then you could pass thecomment
attribute through the appropriate filter.