Rendering a template variable as HTML

django, django-templates

Solution

If you don't want the HTML to be escaped, look at the `safe` filter and the `autoescape` tag:

`safe`:

{{ myhtml |safe }}

`autoescape`:

{% autoescape off %}
    {{ myhtml }}
{% endautoescape %}

Problem

I use the 'messages' interface to pass messages to user like this: ``` request.user.message_set.create(message=message) ``` I would like to include html in my `{{ message }}` variable and render it without escaping the markup in the template.

Original source