当我更改行
时 <a href="/rango/category/{{category.slug}}">
到
<a href="{% url 'show_category' category.slug %}">
我得到NoReverseMatch。出了什么问题?
网址:
app_name="rango"
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^about/', views.about, name='about'),
url(r'^category/(?P<category_name_slug>[\w\-]+)/',
views.show_category, name='show_category'),
url(r'^add_category/$', views.add_category, name='add_category'),
url(r'^category/(?P<category_name_slug>[\w\-]+)/add_page/$', views.add_page, name='add_page'),
]
答案 0 :(得分:0)
您已将应用名称定义为rango
。您需要在撤消网址时使用此功能:
<a href="{% url 'rango:show_category' category.slug %}">