aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Buchert2011-09-27 19:55:33 +0200
committerTomasz Buchert2011-09-27 19:55:33 +0200
commit9fdf67abe09782fea5d103da1d4f6cf58626c517 (patch)
treeacaecca8717b09ea341676c381dd28466da00d2d
parent46f71cc5bef348e4d306e510f074e28d0047296b (diff)
downloaddjango-debug-toolbar-9fdf67abe09782fea5d103da1d4f6cf58626c517.tar.bz2
Refactored template filtering: discard DjDT templates asap.
-rw-r--r--debug_toolbar/panels/template.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py
index 5c20fcd..e5be91e 100644
--- a/debug_toolbar/panels/template.py
+++ b/debug_toolbar/panels/template.py
@@ -51,6 +51,9 @@ class TemplateDebugPanel(DebugPanel):
template_rendered.connect(self._store_template_info)
def _store_template_info(self, sender, **kwargs):
+ t = kwargs['template']
+ if t.name and t.name.startswith('debug_toolbar/'):
+ return # skip templates that we are generating through the debug toolbar.
context_data = kwargs['context']
context_list = []
@@ -95,8 +98,7 @@ class TemplateDebugPanel(DebugPanel):
return _('Templates')
def title(self):
- num_templates = len([t for t in self.templates
- if not (t['template'].name and t['template'].name.startswith('debug_toolbar/'))])
+ num_templates = len(self.templates)
return _('Templates (%(num_templates)s rendered)') % {'num_templates': num_templates}
def url(self):
@@ -117,9 +119,6 @@ class TemplateDebugPanel(DebugPanel):
info = {}
# Clean up some info about templates
template = template_data.get('template', None)
- # Skip templates that we are generating through the debug toolbar.
- if template.name and template.name.startswith('debug_toolbar/'):
- continue
if not hasattr(template, 'origin'):
continue
if template.origin and template.origin.name: