楼主:
uranusjr (â†é€™äººæ˜¯è¶…級笨蛋)
2014-04-05 22:36:53※ 引述《qoorocker (rockers)》之铭言:
: 目前我在处理 template 中 include 时所需传入的参数
: {% include "form.html" with action={% url "blog:create_comment" %} only %}
: 似乎没办法处理 inlcude tag 似乎没办法优先处理完 url tag导致出错
: 错误讯息
: Could not parse the remainder: '{%' from '{%'
: 好像没办法 tag 中 再加 tag, 不知道大家是怎么处理的
确实不行, 这种状况通常是用 url ... as 来处理
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#url
{% url 'blog:create_comment' as action_url %}
{% include 'form.html' with action=action_url only %}