I need a javascript templating system and i think handlebars.js does an excellent job in this case. I'm having syntax conflicts with handlebars templates inside a django template because django tries to render handlebars variables.
Is there a tag in django templates to stop rendering a block with curly braces?
Something like:
{{ django_context_varable }} #works {{% raw %}} <script id="restaurants-tpl" type="text/x-handlebars-template"> <ul> {{#restaurants}} #not rendered by django, plain text <li>{{name}}</li> {{/restaurants}} </ul> </script> {{% endraw %}}
Edit
Likely i found this. It works fine.
Update
Django 1.5 supports verbatim tag natively.
I use a custom template tag for another js templating system, here: https://gist.github.com/629508
Use in template:
{% load mytags %} {% verbatim %} {{ This won't be touched by {% django's %} template system }} {% endverbatim %}
Edit: This custom template tag is no longer necessary, as Django's template language now supports the {% verbatim %} template tag.
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