Django templates - I want to render newline as \n instead of <br>

341 Views Asked by At

I'm generating an XML file using Django template language and I came across a problem with linebreaks.

I'm trying to render textarea but I need to keep newlines - \n because the facebook catalogue feed accepts only \n as a newline.

I can't figure out how to make it work. linebreaks filter doesn't work.

Also |safe doesn't seem to work.

<description><![CDATA[{{ object.description|safe|truncatechars:5000 }}]]></description>

Do you know how to do that?

0

There are 0 best solutions below