aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/toolbar.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-13 20:40:22 +0100
committerAymeric Augustin2013-11-13 20:40:22 +0100
commit97090c32941784d28818721f37eee69e21e2d74e (patch)
treefdabb0301faf9595312b908e738638d18ecffacb /debug_toolbar/toolbar.py
parenta3acf6b57275f2a14cde7c209a8b6dff107275b0 (diff)
downloaddjango-debug-toolbar-97090c32941784d28818721f37eee69e21e2d74e.tar.bz2
Provide an option to force rendering panels in page.
Requested by David who seems to runs the debug toolbar in production :-)
Diffstat (limited to 'debug_toolbar/toolbar.py')
-rw-r--r--debug_toolbar/toolbar.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py
index bf632cd..3f274d0 100644
--- a/debug_toolbar/toolbar.py
+++ b/debug_toolbar/toolbar.py
@@ -51,10 +51,9 @@ class DebugToolbar(object):
Renders the overall Toolbar with panels inside.
"""
context = self.template_context.copy()
- context.update({
- 'panels': self.panels,
- 'storage_id': self.store(),
- })
+ context['panels'] = self.panels
+ if not self.should_render_panels():
+ context['storage_id'] = self.store()
return render_to_string('debug_toolbar/base.html', context)
# Handle storing toolbars in memory and fetching them later on
@@ -62,6 +61,12 @@ class DebugToolbar(object):
_counter = 0
_storage = SortedDict()
+ def should_render_panels(self):
+ render_panels = dt_settings.CONFIG['RENDER_PANELS']
+ if render_panels is None:
+ render_panels = self.request.META['wsgi.multiprocess']
+ return render_panels
+
def store(self):
cls = type(self)
cls._counter += 1