J
J
jottygroups2019-11-12 20:10:50
Django
jottygroups, 2019-11-12 20:10:50

Problem with Django autoescape?

Hello. I'm writing my own blog, but there's a problem.
If I want to autoescape off inside the block and display a variable with the tag , then for some reason it is displayed outside this block...
So in the layout in the file:

<p id="text_blog">{% autoescape off %}{{ blog.text }}{% endautoescape %}</p>

So in the end on the site: I repeat: only with the tag. If the text is without "b", "h1" and other things, then it is displayed correctly, inside the paragraph. For those who want to say something about JS - there is protection, the script tag and all content will be displayed as text, while the tags I allowed will work.
<p id="text_blog"></p><h1>testh1</h1><p></p>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jottygroups, 2019-11-12
@jottygroups

There are no nested p tags, if the next tag is encountered, then the previous one is automatically closed. This was my mistake. Thanks Bacon for the help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question