Take the 2-minute tour ×

I'm trying to make a webcomic RSS feed with Django, but I can't put an image in the description field, because the html code gets escaped, even if it's in an {% autoescape off %} block.

Here is my description template:

{% autoescape off %}
<img src="{{obj.img.url}}"/>
{% endautoescape %}

And this is the result:

&lt;img src="http://localhost:8000/media/comics/001__.png"/&gt;

How can I avoid this autoescaping?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

How can I avoid this autoescaping?

Actually, you need to keep this auto-escaping... Look carefully at any other rss feeds: xkcd.com/rss.xml

Quote from spec by the RSS Advisory Board:



share|improve this answer
Thank you VERY much. –  Gonzalo Quero Aug 26 '09 at 2:52
add comment

This doesn't seem to have anything to do with autoescaping, as that would never 'escape' the hard-coded tags that you entered explicitly in your template as you have here.

I suspect there's something further down the line that is doing the escaping. Can you post the code that renders the template and does something with the result?

share|improve this answer
add comment

Your Answer


