问题
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