Re: [問題] django inlucde tag 參數問題
※ 引述《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
推
04/06 17:21, , 1F
04/06 17:21, 1F
→
04/06 17:22, , 2F
04/06 17:22, 2F
推
04/06 17:29, , 3F
04/06 17:29, 3F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章