[Django]-New line not rendering from template tag in HTML

5👍

Use the template filter linebreaksbr like so :

<p class="message">{{ product.message|linebreaksbr }}</p>

1👍

In order to have the line information you can use pre tag to keep track of empty spaces and new line.

let message = `Lorem ipsum text Lorem ipsum text Lorem ipsum text.
Lorem ipsum textLorem ipsum text

Lorem ipsum textLorem ipsum textLorem ipsum textLorem ipsum textLorem ipsum textLorem ipsum textLorem ipsum textLorem ipsum textLorem ipsum text`;
<div><pre>{message}</pre></div>

Leave a comment