django using string for url patterns code example
Example 1: django regular expression
from django.urls import path
from . import views
urlpatterns = [
path('articles/2003/', views.special_case_2003),
path('articles/<int:year>/', views.year_archive),
path('articles/<int:year>/<int:month>/', views.month_archive),
path('articles/<int:year>/<int:month>/<slug:slug>/', views.article_detail),
]
Example 2: slug urls django
path('<slug:slug>,<int:id>/', views.article_detail, name='article'),