newline in models.TextField() not rendered in template

django, newline

Solution

`linebreaks`

Replaces line breaks in plain text with appropriate HTML; a single newline becomes an HTML line break (`<br />`) and a new line followed by a blank line becomes a paragraph break (`</p>`).

For example:

`{{ value|linebreaks }}`

Problem

I have a model with an attribute, ``` desc = models.TextField() ``` I entered data using admin interface provided by Django and then later viewed my template where the database values are fetched and displayed. In my admin interface I left newline (just by leaving blank lines in between my paragraphs) but they are displayed as a single paragraph in my template. I'm using Django 1.3 and MySQL.

Original source

Related problems