0
我想知道是否有必要在我的urls.py这两个模式:我可以合并这两种网址格式吗?
url(r'^books/author/(?P<id>\d+)/$', 'books.views.author'),
url(r'^books/author/(?P<id>\d+)/(?P<slug>[-\w]+)/$', 'books.views.author'),
基本上,蛞蝓是可选的。而查看功能的定义是这样的:
def author(request, id, slug=None):
请指教。