Skip to content

Commit 69f1c77

Browse files
committed
The toolbar can't be assigned at init - so grab it each time the method is called
1 parent d034c94 commit 69f1c77

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

debug_toolbar/panels/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class DebugPanel(object):
1818
# Panel methods
1919
def __init__(self, context={}):
2020
self.context.update(context)
21-
self.toolbar = DebugToolbarMiddleware.get_current()
2221
self.slug = slugify(self.name)
2322

2423
def dom_id(self):
@@ -46,14 +45,16 @@ def content(self):
4645
return render_to_string(self.template, context)
4746

4847
def record_stats(self, stats):
49-
panel_stats = self.toolbar.stats.get(self.slug)
48+
toolbar = DebugToolbarMiddleware.get_current()
49+
panel_stats = toolbar.stats.get(self.slug)
5050
if panel_stats:
5151
panel_stats.update(stats)
5252
else:
53-
self.toolbar.stats[self.slug] = stats
53+
toolbar.stats[self.slug] = stats
5454

5555
def get_stats(self):
56-
return self.toolbar.stats.get(self.slug, {})
56+
toolbar = DebugToolbarMiddleware.get_current()
57+
return toolbar.stats.get(self.slug, {})
5758

5859
# Standard middleware methods
5960
def process_request(self, request):

0 commit comments

Comments
 (0)