Re: [问题] django inlucde tag 参数问题

楼主: 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 %}
作者: qoorocker (rockers)   2014-04-06 17:21:00
成功了!~ 感谢你 救星阿~~~ 号其在问问permission 这方面你们是怎么控制的?
作者: timTan (用口头禅区分年记)   2014-04-06 17:29:00
另外开文讨论吧

Links booklink

Contact Us: admin [ a t ] ucptt.com