aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/panels/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'debug_toolbar/panels/__init__.py')
-rw-r--r--debug_toolbar/panels/__init__.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py
index d4a61da..9586e80 100644
--- a/debug_toolbar/panels/__init__.py
+++ b/debug_toolbar/panels/__init__.py
@@ -22,31 +22,44 @@ class DebugPanel(object):
context = {}
# Panel methods
+
def __init__(self, toolbar, context={}):
self.toolbar = toolbar
self.context.update(context)
self.slug = slugify(self.name)
+ def content(self):
+ if self.has_content:
+ context = self.context.copy()
+ context.update(self.get_stats())
+ return render_to_string(self.template, context)
+
def dom_id(self):
return 'djDebug%sPanel' % (self.name.replace(' ', ''))
+ # Titles and subtitles
+
def nav_title(self):
- """Title showing in toolbar"""
+ """Title showing in sidebar"""
raise NotImplementedError
def nav_subtitle(self):
- """Subtitle showing until title in toolbar"""
+ """Subtitle showing under title in sidebar"""
return ''
def title(self):
"""Title showing in panel"""
raise NotImplementedError
- def content(self):
- if self.has_content:
- context = self.context.copy()
- context.update(self.get_stats())
- return render_to_string(self.template, context)
+ # Enable and disable (expensive) instrumentation
+
+ def enable_instrumentation(self):
+ pass
+
+ def disable_instrumentation(self):
+ pass
+
+ # Store and retrieve stats (shared between panels)
def record_stats(self, stats):
panel_stats = self.toolbar.stats.get(self.slug)