About Parameters for Included URL Rules

When you include app-specific URLs in Django URL configuration, you can pass common parameters for all the views of the included app as follows:

1
2
3
4
5
6
7
8
urlpatterns = [
    # ...
    url(
        r"^feedback/", 
        include("feedback.urls", namespace="feedback"), 
        {"base_template_name": "base_v2.html"},
    ),
]

Here the base_template_name parameter will be passed to all the views mentioned at URL rules of the feedback app.

Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2