作者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://www.ptt.cc/bbs/Python/M.1396708616.A.58F.html
推 qoorocker:成功了!~ 感謝你 救星阿~~~ 號其在問問 04/06 17:21
→ qoorocker:permission 這方面你們是怎麼控制的? 04/06 17:22
推 timTan:另外開文討論吧 04/06 17:29