Last active
March 29, 2018 17:14
-
-
Save nwjlyons/c02aee9f0f408a3815b3b741cafe4eee to your computer and use it in GitHub Desktop.
Django 2.0 nested URLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.djangoproject.com/en/2.0/topics/http/urls/#including-other-urlconfs | |
from django.urls import include, path | |
from . import views | |
# Change this | |
urlpatterns = [ | |
path('<page_slug>-<page_id>/history/', views.history), | |
path('<page_slug>-<page_id>/edit/', views.edit), | |
path('<page_slug>-<page_id>/discuss/', views.discuss), | |
path('<page_slug>-<page_id>/permissions/', views.permissions), | |
] | |
# To this | |
urlpatterns = [ | |
path('<page_slug>-<page_id>/', include([ | |
path('history/', views.history), | |
path('edit/', views.edit), | |
path('discuss/', views.discuss), | |
path('permissions/', views.permissions), | |
])), | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment