[Django]-Django template and XML question

3👍

Replace {{item}} with {{item|safe}} in your code. It will avoid escaping HTML characters. For more information, see this doc page.

5👍

You should surround the for block with autoescape tags like so:

<?xml version="1.0" encoding="UTF-8"?><rss version="0.92">
{% autoescape off %}
    {% for item in list%}
    {{item}}
    {% endfor %}
{% endautoescape %}

django won’t escape the characters between the autoescape tags

see here:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#autoescape

👤Blake

Leave a comment