Django Url, Slug for Detail Page
The urls are the problem, the first one will match everything (/blog/
, /blog/test/
, /blog/awdlawdjaawld
), you need the dollar sign $
at the end of it to only match /blog/
.
url(r'^blog/$', 'myapp.views.blog', name='blog'),
url(r'^blog/(?P<slug>[\w-]+)/$', 'myapp.views.blog_detail', name='blog_detail'),
The above should work correctly.
This is a good reference for Regular Expressions