[Django]-How do I html format my blog post in django?

7👍

You can render it with the |safe template filter [Django-doc]. This will disable escaping HTML fragments, and it will thus no longer convert < to &lt; for example:

<h1>{{ blog.title|safe }}</h1>
  <hr>
  <p>{{ blog.description|safe }}</p>

You however might want to take a look at the django-ckeditor package [GitHub] which offers a dedicated field, widget, etc. to enable editing the text with respect to rendering.

Leave a comment