.*
/edit/
/delete/
urlpatterns = [ #... url(r'^(?P<slug>.*)/$', post_detail, name='detail'), url(r'^(?P<slug>.*)/edit/$', post_update, name='update'), url(r'^(?P<slug>.*)/delete/$', post_delete), ]
[-\w+]
-
urlpatterns = [ #... url(r'^(?P<slug>[-\w]+)/$', post_detail, name='detail'), url(r'^(?P<slug>[-\w]+)/edit/$', post_update, name='update'), url(r'^(?P<slug>[-\w]+)/delete/$', post_delete), ]
参考:
https://www.jianshu.com/p/8207b66db9ca
https://www.cnblogs.com/yang-wei/p/9997776.html
来源:博客园
作者:anobscureretreat
链接:https://www.cnblogs.com/sea-stream/p/11518143.html