I want to add an optional Stackoverlow like slug to my urls in Django
path(
r"item/<int:pk>/<slug:slug>",
ItemDetailView.as_view(),
name="item_detail",
),
How do I make the slug optional so that it works in all three cases:
- item/1
- item/1/
- item/1/slug