相关疑难解决方法(0)

Django模板中的Handlebars.js

我需要一个javascript模板系统,我认为handlebars.js在这种情况下表现非常出色.我与django模板中的把手模板有语法冲突,因为django尝试渲染把手变量.

django模板中是否有标记用于停止使用花括号渲染块?

就像是:

{{ 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 %}}
Run Code Online (Sandbox Code Playgroud)

编辑

可能我发现了这个.它工作正常.

更新

Django 1.5原生支持逐字标记.

django django-templates handlebars.js

30
推荐指数
2
解决办法
1万
查看次数

标签 统计

django ×1

django-templates ×1

handlebars.js ×1