我知道我在这里做了一些愚蠢的事情,但我似乎找不到它(一定是愚蠢的)。
在 urls.py 我有:
urlpatterns=patterns(...
...
url(r'(?P<cat>[-\w]*)/(?P<slug>[-\w]+)/$', PlantDetailView.as_view(), name='detail-view'),
....
)
在模板中我有:
{% url 'detail-view' cat=category_slug slug=plant.slug %}
但我收到以下 NoReverseMatch 错误:
Reverse for 'detail-view' with arguments '()' and keyword arguments '{u'slug': u'foo', u'cat': u'bar'}' not found.
我试过使用*args
and **kwargs
,但没有运气。
感谢您的帮助!