Closed creamidea closed 10 years ago
这个问题折腾了我半天,为何Handlebars.js 不工作?终于查到是因为Django templates渲染引擎在作怪。理论上这次开发不用Django templates,但是有一个CSRF这个东西,也就是有一个标签{% csrf_token %}要用,于是只能查局部关闭渲染的方法了。
关闭方法:使用{% verbatim %} {% endverbatim %},代码示例如下:
<script id="entry-template" type="text/x-handlebars-template"> {% verbatim %} <div class="entry"> <h1>{{ title }}</h1> <div class="body"> {{ body }} </div> </div> {% endverbatim %} </script>
Reference:
这个问题折腾了我半天,为何Handlebars.js 不工作?终于查到是因为Django templates渲染引擎在作怪。理论上这次开发不用Django templates,但是有一个CSRF这个东西,也就是有一个标签{% csrf_token %}要用,于是只能查局部关闭渲染的方法了。
关闭方法:使用{% verbatim %} {% endverbatim %},代码示例如下:
Reference: