I am using django to serve a page that includes a handlebars template. Mixing server and client side templating creates some ambiguity. If I have a template
<script id="my-script" type="text/x-handlebars-template">
<p> {{clientSideContent}} </p>
</script>
How can I tell the django templating engine that the {{clientSideContent}} tag isn't intended for it (since django and handlebars use the same tags)? Is there a raw strings tag in django, or an alternate good way to address this?
I think this should solve your problem
https://gist.github.com/ericflo/629508
so use something like
{% verbatim %} {{clientSideContent}} {% endverbatim %}
Never versions of django (starting from version 1.5) have support for the {% verbatim %} tag:
So something like this should work:
<script id="my-script" type="text/x-handlebars-template">
{% verbatim %}
<p> {{clientSideContent}} </p>
{% endverbatim %}
</script>
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With