15👍
✅
You need to mark the content as safe. So change your template to:
{% for post in posts %}
...
{{ post.content|safe }}
...
{% endfor %}
By default HTML is not escaped and so is displayed as text, which is why you’re seeing the <p>
tags. You need to mark the field as safe
so that Django renders it as HTML. See the documentation for more info.
1👍
{{article.body|safe}}
or
{{article.body|truncatechars:150|safe}}
or
{{article.body|truncatewords:25|safe}}
👤Gata
- [Django]-Using statprof to profile a Django view – can not use signals in thread
- [Django]-Editable choice field/drop down box in Django forms
Source:stackexchange.com