0

I am trying to render html output that is generated by a python google maps library that involves JS code in it. I am passing the part that shows google map with the html_map variable, and as follows:

html = t.render(Context({'html_map':html_map}))
return HttpResponse(html)

However, instead of showing the map, the page shows js code(i.e., directly prints it). The image below shows this:

Output

How can I solve this?

1 Answer 1

3
html = t.render(Context({'html_map':html_map}))
return HttpResponse(html)

use in template:

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

1 Comment

I don't even know Django, but this looks correct since the OP is escaping HTML that doesn't need escaping

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.