0

I pass string variable to django template as context variable:

my_var = "<h1> hihih </h1>"

In my template, I use {{ my_var }} and want to show it as HTML, not just <h1> hihih </h1>.

Is it possible?

(I don't need any other kind solution...)

1 Answer 1

3

You can use safe filter for that:

{{ my_var|safe }}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.