Skip to content

Commit dc04efa

Browse files
committed
Reduce the risk of circular imports.
1 parent 4b712fd commit dc04efa

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

debug_toolbar/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
VERSION = 'unknown'
1212

1313

14-
from .toolbar import DebugToolbar
14+
# Code that discovers files or modules in INSTALLED_APPS imports this module.
15+
# Reference URLpatterns with a string to avoid the risk of circular imports.
1516

16-
17-
urls = DebugToolbar.get_urls(), 'djdt', 'djdt'
17+
urls = 'debug_toolbar.toolbar', 'djdt', 'djdt'

debug_toolbar/toolbar.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,6 @@ def get_urls(cls):
130130
urlpatterns += panel_class.get_urls()
131131
cls._urlpatterns = urlpatterns
132132
return cls._urlpatterns
133+
134+
135+
urlpatterns = DebugToolbar.get_urls()

0 commit comments

Comments
 (0)