Could not parse the reminder in django

梦想的初衷 提交于 2020-01-02 10:07:17

问题


I want to add a script tag inside a jquery template. So am referring to this link. It tells to close the inner script tag in the following way :

<script id="filaVideoTemplate" type="text/x-jQuery-tmpl">
    <!-- Some HTML here -->
    <script type="text/javascript">
    <!-- Some javascript here -->
    {{html "</sc"+"ript>"}}
</script>

I tried it, but django shows this error: Could not parse the remainder: '" < /sc"+"ript>"' from 'html "< /sc"+"ript>"'

.How can I do this django. Is there any specific solution in django for this?


回答1:


{ and } are reserved characters in Django templates, so you need to use templatetag.

Replace:

{{html "</sc"+"ript>"}}

With:

{% templatetag openbrace %}{% templatetag openbrace %}html "</sc"+"ript>"{% templatetag closebrace %}{% templatetag closebrace %}


来源:https://stackoverflow.com/questions/10382483/could-not-parse-the-reminder-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!