Escaping characters in Jinja2 (Flask, Django)


22/03/2019, 17:05

You can escaping characters this way:

{{ "<something to escape />" }}
{{ '{{ url_for("homepage") }}' }}

or with raw method:

{% raw %}
    {{ url_for("homepage") }}
{% endraw %}

Notice raw doesn't escapes html tags, for tags i suggest to use first method.



Комментарии