I have the following error while trying to load up specific index numbers (relating to blog posts) using Django.
The erroneous code is below - can anyo
The problem is that you are confused between the old regex-based URL mechanism and the new path-based one. If you use path
, you should use the new special syntax:
path('<int:pk>', DetailView.as_view(...))
whereas if you want to use regexes, you should use the old url
function (or the new alias, re_path
):
url(r'(?P<pk>\d+)', DetailView.as_view(...))