mark_safe does not work in Django #217
-
|
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.
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.
-
|
Yep. That's right. |
Beta Was this translation helpful? Give feedback.
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