In my Django app I have:
models.py
content_don = models.TextField()
I write content into that field and then save it with 'Submit'. Problem is, on my page I preview it with:
post.html
<p class="article-content mt-3 mb-1"><strong>Description: </strong></p>
<div class="media content-section mt-1 mb-1">
<p class="lead">{{ post.content_don }}</p>
</div>
All content is in the same row. There are now rows which I typed in when I wrote text during form input. Why is that?
HTML needs the newlines converted into markup, typically <br>
. There's a Django builtin linebreaks to do this.
{{ post.content_don|linebreaks }}