Django template to respect plain text field linebreaks

By | 20 May, 2015

If you have a text field with linebreaks in your nice django admin and your cool template refuses to respect them, use this in your template:

{{ variable|linebreaks }}

this replaces newlines with HTML

<br />

and newlines with blank lines with

<p></p>

Learn tons of great stuff from your trusty Django docs:
Built-in template tags and filters