Answer the question
In order to leave comments, you need to log in
How to escape tags from a variable in Jinja?
There is some pattern. I want the variable containing html to be output as html, not just text. Is there any filter for this? I tried escape, but it doesn't work and it outputs the
variable from the database as PS text, the data to which I added through the django admin panel<br>
{{ value|escape }}
<!-- Будет выведено обычным текстом <br> и -->
Answer the question
In order to leave comments, you need to log in
Obviously needed without shielding.
{{ value }}
If escaping is enabled by default, then you can
1) Mark the variable as safe and not escaping:
{{ value|safe }}
2) Or you can use the entire block:
{% autoescape false %}
Autoescaping is inactive within this block
{% endautoescape %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question