mark_safe does not work in Django #217
Answered
by
Archmonger
milescatlett
asked this question in
Problem
-
Hi, the Django function mark_safe, nor the template | safe work with components. I am not able to save html in the database and display it in a component. Is there any possibility to add support for this, or is there a work around? |
Beta Was this translation helpful? Give feedback.
Answered by
Archmonger
Jan 30, 2024
Replies: 2 comments 4 replies
-
Just transferred this discussion to the Admittedly I haven't tried using Django template filters with our template tag. Are you trying to use them like this? {% component "example.path" "<div> Hello World </div>" | safe %} |
Beta Was this translation helpful? Give feedback.
2 replies
-
Yep. That's right. |
Beta Was this translation helpful? Give feedback.
2 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
I'm going to assume your html strings are already escaped prior to entering the template and/or ReactPy.
If you want to unescape them, you can use
html.unescape