diff options
| author | Tomasz Buchert | 2011-09-27 19:55:33 +0200 |
|---|---|---|
| committer | Tomasz Buchert | 2011-09-27 19:55:33 +0200 |
| commit | 9fdf67abe09782fea5d103da1d4f6cf58626c517 (patch) | |
| tree | acaecca8717b09ea341676c381dd28466da00d2d /debug_toolbar/panels/template.py | |
| parent | 46f71cc5bef348e4d306e510f074e28d0047296b (diff) | |
| download | django-debug-toolbar-9fdf67abe09782fea5d103da1d4f6cf58626c517.tar.bz2 | |
Refactored template filtering: discard DjDT templates asap.
Diffstat (limited to 'debug_toolbar/panels/template.py')
| -rw-r--r-- | debug_toolbar/panels/template.py | 9 |
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: |
