How to output text from database with line breaks in a django template?
Use linebreaks
or linebreaksbr
filter:
{{ text|linebreaks }}
Or surround the text with <pre>...</pre>
.
<pre>{{ text }}</pre>
I linebreaks
uses <p>
tag to convert new line, this will probally not preserve the empty line or you will just not see it due to css styling.
You can try instead linkebrksbr that will use <br/>
for new lines.
Hope this helps