About Nested Path Definitions

In Django, you can have nested path definitions like so:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from django.urls import path, include
from . import views

urlpatterns = [
    path("", views.post_list, name="post_list"),
    path("<slug:slug>/", include([
        path("", views.post_detail, name="post_detail"),
        path("change/", views.change_post, name="change_post"),
        path("delete/", views.delete_post, name="delete_post"),
    ]), 
]

Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2