Skip to content

Commit 0e4b4c0

Browse files
committed
Account for changes in include() in Django 1.9+.
Fix #764.
1 parent 4111d93 commit 0e4b4c0

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

debug_toolbar/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@
1111

1212

1313
# Code that discovers files or modules in INSTALLED_APPS imports this module.
14-
# Reference URLpatterns with a string to avoid the risk of circular imports.
1514

16-
urls = 'debug_toolbar.toolbar', 'djdt', 'djdt'
15+
# Reference URLpatterns with an iterator to avoid circular imports.
16+
17+
def urlpatterns():
18+
from debug_toolbar.toolbar import DebugToolbar
19+
for pattern in DebugToolbar.get_urls():
20+
yield pattern
21+
22+
23+
urls = urlpatterns(), 'djdt', 'djdt'
1724

1825

1926
default_app_config = 'debug_toolbar.apps.DebugToolbarConfig'

debug_toolbar/toolbar.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,3 @@ def get_urls(cls):
146146
urlpatterns += panel_class.get_urls()
147147
cls._urlpatterns = urlpatterns
148148
return cls._urlpatterns
149-
150-
151-
urlpatterns = DebugToolbar.get_urls()

0 commit comments

Comments
 (0)