django linebreaksbr
During some client work my friend and I ran into an issue where we didn't want a
full "rich text" style on a Django template (the client uses WagTail), but instead
just show linebreak/carriage returns in a <p>
element.
This can be accomplished in two ways:
- Showing a
|linebreaks
which changes the displays to blocks - Showing a
|linbreaksbr
which changes the carriage returns to<br>
elements
Link to the StackOverflow we found
Example intended result:
This text would have a
linebreak
Actual display:
This text would have a linebreak
Changing the display:
<div>
<p>
{{ some_text|linebreaksbr}}
</p>
</div>