The Django Basic Inlines app renders a pre-determined template from a pseudo-HTML syntax, based on an app/model/id combination. For example, if you're writing a blog post, you can insert an image that was saved in your image model:
# In the admin
This is the body of my post.
<inline type="media.image" id="1" class="full">
The template then takes a render_inlines
filter, which requires to be marked safe
so as to render the HTML properly:
# Template
{{ post.body|render_inlines|safe }}
But even with safe
, the filter still escapes the HTML, creating <p><img src="..."><p>
in the source.
According to the docs, the filter should use mark_safe
to prevent autoescaping at the filter level, but the inlines
function in parser.py
already uses mark_safe
.
Is there something that is further needed in Django 1.4 to stop autoescaping at the custom filter layer? I can't seem to get rid of this autoescaping, either at the
I tried using autoescape=None
, which didn't seem to help either.