File tree Expand file tree Collapse file tree 6 files changed +11
-12
lines changed Expand file tree Collapse file tree 6 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,8 @@ def is_toolbar_request(cls, request):
143143 """
144144 Determine if the request is for a DebugToolbar view.
145145 """
146+ from debug_toolbar .urls import app_name
147+
146148 # The primary caller of this function is in the middleware which may
147149 # not have resolver_match set.
148150 try :
@@ -152,7 +154,3 @@ def is_toolbar_request(cls, request):
152154 except Resolver404 :
153155 return False
154156 return resolver_match .namespaces and resolver_match .namespaces [- 1 ] == app_name
155-
156-
157- app_name = "djdt"
158- urlpatterns = DebugToolbar .get_urls ()
Original file line number Diff line number Diff line change 1+ from debug_toolbar .toolbar import DebugToolbar
2+
3+ app_name = "djdt"
4+ urlpatterns = DebugToolbar .get_urls ()
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ Next version
1111 usages before ``enable_instrumentation `` is called.
1212* Add check ``W006 `` to warn that the toolbar is incompatible with
1313 ``TEMPLATES `` settings configurations with ``APP_DIRS `` set to ``False ``.
14+ * Create ``urls `` module and update documentation to no longer require
15+ importing the toolbar package.
1416
1517
16183.2.2 (2021-08-14)
Original file line number Diff line number Diff line change @@ -79,12 +79,11 @@ Add django-debug-toolbar's URLs to your project's URLconf:
7979
8080.. code-block :: python
8181
82- import debug_toolbar
8382 from django.urls import include, path
8483
8584 urlpatterns = [
8685 # ...
87- path(' __debug__/' , include(debug_toolbar.urls)),
86+ path(' __debug__/' , include(' debug_toolbar.urls' )),
8887 ]
8988
9089 This example uses the ``__debug__ `` prefix, but you can use any prefix that
Original file line number Diff line number Diff line change 22from django .urls import include , path
33from django .views .generic import TemplateView
44
5- import debug_toolbar
6-
75urlpatterns = [
86 path ("" , TemplateView .as_view (template_name = "index.html" )),
97 path ("jquery/" , TemplateView .as_view (template_name = "jquery/index.html" )),
108 path ("mootools/" , TemplateView .as_view (template_name = "mootools/index.html" )),
119 path ("prototype/" , TemplateView .as_view (template_name = "prototype/index.html" )),
1210 path ("admin/" , admin .site .urls ),
13- path ("__debug__/" , include (debug_toolbar .urls )),
11+ path ("__debug__/" , include (" debug_toolbar.urls" )),
1412]
Original file line number Diff line number Diff line change 22from django .contrib .auth .views import LoginView
33from django .urls import include , path , re_path
44
5- import debug_toolbar
6-
75from . import views
86from .models import NonAsciiRepr
97
2523 path ("redirect/" , views .redirect_view ),
2624 path ("login_without_redirect/" , LoginView .as_view (redirect_field_name = None )),
2725 path ("admin/" , admin .site .urls ),
28- path ("__debug__/" , include (debug_toolbar .urls )),
26+ path ("__debug__/" , include (" debug_toolbar.urls" )),
2927]
You can’t perform that action at this time.
0 commit comments