Django url pattern that have a number parameter is:
url(r\'^polls/(?P\\d+)/$\', \'polls.views.detail\')
What will be the correct
From Django 2.0 onward, path
has been introduced. path
does not take reg ex in urls, hence it is meant to be a simplified version of the older url
From 2.0 onward you can use path instead like below :
path('polls/', views.polls_detail)
string path parameters need not be explicitly specified, as default data type for path parameters is string itself.
Ref : https://docs.djangoproject.com/en/2.0/releases/2.0/#whats-new-2-0