作者uranusjr (←这人是超级笨蛋)
看板Python
标题Re: [问题] django inlucde tag 参数问题
时间Sat Apr 5 22:36:53 2014
※ 引述《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 %}
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 218.161.94.175
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Python/M.1396708616.A.58F.html
1F:推 qoorocker:成功了!~ 感谢你 救星阿~~~ 号其在问问 04/06 17:21
2F:→ qoorocker:permission 这方面你们是怎麽控制的? 04/06 17:22
3F:推 timTan:另外开文讨论吧 04/06 17:29