django通过url templatetag传递额外选项以查看

django通过url templatetag传递额外选项以查看,django,django-urls,Django,Django Urls,我的url文件中有以下行 url(r'^confirm/$', 'confirm', {'status':'live'}, name="confirm"), 如您所见,我正在将额外选项status传递给所描述的视图 我想使用urltemplatetag通过模板传递状态值。我试过了 {%url confirm status='pending'%}但出现以下错误: Caught NoReverseMatch while rendering: Reverse for 'confirm' with a

我的url文件中有以下行

url(r'^confirm/$', 'confirm', {'status':'live'}, name="confirm"),
如您所见,我正在将额外选项
status
传递给所描述的视图

我想使用
url
templatetag通过模板传递状态值。我试过了

{%url confirm status='pending'%}
但出现以下错误:

Caught NoReverseMatch while rendering: Reverse for 'confirm' with arguments '()' and keyword arguments '{'status': u'pending'}' not found.  Is it possible to do what I am trying to do?

这怎么行?
url
标记只输出在urlconf中有效的url,并将参数映射到url中。但是你的url没有位置为状态的替代值-它是硬编码的

如果要将参数传递到URL模式中,该模式需要为参数留出空间