File tree 2 files changed +6
-7
lines changed
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ class DebugPanel(object):
18
18
context = {}
19
19
20
20
# Panel methods
21
- def __init__ (self , context = {}):
21
+ def __init__ (self , toolbar , context = {}):
22
+ self .toolbar = toolbar
22
23
self .context .update (context )
23
24
self .slug = slugify (self .name )
24
25
@@ -44,16 +45,14 @@ def content(self):
44
45
return render_to_string (self .template , context )
45
46
46
47
def record_stats (self , stats ):
47
- toolbar = DebugToolbarMiddleware .get_current ()
48
- panel_stats = toolbar .stats .get (self .slug )
48
+ panel_stats = self .toolbar .stats .get (self .slug )
49
49
if panel_stats :
50
50
panel_stats .update (stats )
51
51
else :
52
- toolbar .stats [self .slug ] = stats
52
+ self . toolbar .stats [self .slug ] = stats
53
53
54
54
def get_stats (self ):
55
- toolbar = DebugToolbarMiddleware .get_current ()
56
- return toolbar .stats .get (self .slug , {})
55
+ return self .toolbar .stats .get (self .slug , {})
57
56
58
57
# Standard middleware methods
59
58
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ def load_panels(self):
45
45
"""
46
46
global panel_classes
47
47
for panel_class in panel_classes :
48
- panel_instance = panel_class (context = self .template_context )
48
+ panel_instance = panel_class (self , context = self .template_context )
49
49
50
50
self ._panels [panel_class ] = panel_instance
51
51
You can’t perform that action at this time.
0 commit comments