Search code examples
djangonewlinedjango-comments

Django comments taking out new lines


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


Solution

  • Have you looked at the linebreaks and linebreaksbr filters? Instead of using the render_comment_list tag, you'd use the get_comment_list tag to get a list of Comment objects, then you could pass the comment attribute through the appropriate filter.