You can use tags in your django templates do avoid that issue. For instance, I am using icanhaz which use mustache's templates ({{}}) and I inspired myself of a snippet called Verbatim. So, basically, in your template you do:
<body>
{% js_template test %}
Here you can freely use {{}} because the surrounding tags make django ignore them.
{% endjs_template %}