My url is like this below. it accepts /tracks/1
,/tracks/2
path('tracks/<int:pk>',views.tracks,name='tracks'),
However I want to accept /tracks
without pk value.
How can I do this?
My url is like this below. it accepts /tracks/1
,/tracks/2
path('tracks/<int:pk>',views.tracks,name='tracks'),
However I want to accept /tracks
without pk value.
How can I do this?
Just add another route to the urlpatterns
that returns the same view (or any view you want)
path('tracks/<int:pk>',views.tracks,name='tracks'),
path('tracks/',views.your_view ,name='name'),