Django url pattern that have a number parameter is:
url(r\'^polls/(?P\\d+)/$\', \'polls.views.detail\')
What will be the correct
If you are using Django version >= 2.0, then this is done simply like below.
from django.urls import path urlpatterns = [ ... path('polls//$','polls.views.detail') ... ]
Source: https://docs.djangoproject.com/en/2.0/ref/urls/#django.urls.path