diff options
Diffstat (limited to 'debug_toolbar/panels/templates')
| -rw-r--r-- | debug_toolbar/panels/templates/panel.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/debug_toolbar/panels/templates/panel.py b/debug_toolbar/panels/templates/panel.py index df39804..74f28b0 100644 --- a/debug_toolbar/panels/templates/panel.py +++ b/debug_toolbar/panels/templates/panel.py @@ -81,12 +81,8 @@ class TemplatesPanel(Panel): def __init__(self, *args, **kwargs): super(TemplatesPanel, self).__init__(*args, **kwargs) self.templates = [] - template_rendered.connect(self._store_template_info) def _store_template_info(self, sender, **kwargs): - if not self.enabled: - return - template, context = kwargs['template'], kwargs['context'] # Skip templates that we are generating through the debug toolbar. @@ -157,6 +153,12 @@ class TemplatesPanel(Panel): url(r'^template_source/$', 'template_source', name='template_source'), ) + def enable_instrumentation(self): + template_rendered.connect(self._store_template_info) + + def disable_instrumentation(self): + template_rendered.disconnect(self._store_template_info) + def process_response(self, request, response): template_context = [] for template_data in self.templates: |
