diff options
| author | Aymeric Augustin | 2013-11-24 17:30:49 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-11-24 17:30:49 +0100 | 
| commit | 57a6e261c2768503e1401f99cefd4470c8dc5e8f (patch) | |
| tree | ad0f1553d0155988701b1d63f0f4438ae127bcab /debug_toolbar/panels/templates/panel.py | |
| parent | 3d72c1fa927f129b2a79ea3496cce3262516705b (diff) | |
| download | django-debug-toolbar-57a6e261c2768503e1401f99cefd4470c8dc5e8f.tar.bz2 | |
Update all panels to follow the public API.
Diffstat (limited to 'debug_toolbar/panels/templates/panel.py')
| -rw-r--r-- | debug_toolbar/panels/templates/panel.py | 22 | 
1 files changed, 11 insertions, 11 deletions
| diff --git a/debug_toolbar/panels/templates/panel.py b/debug_toolbar/panels/templates/panel.py index c745b83..ec0fc47 100644 --- a/debug_toolbar/panels/templates/panel.py +++ b/debug_toolbar/panels/templates/panel.py @@ -48,10 +48,6 @@ class TemplatesPanel(Panel):      """      A panel that lists all templates used during processing of a response.      """ -    name = 'Templates' -    template = 'debug_toolbar/panels/templates.html' -    has_content = True -      def __init__(self, *args, **kwargs):          super(TemplatesPanel, self).__init__(*args, **kwargs)          self.templates = [] @@ -113,19 +109,23 @@ class TemplatesPanel(Panel):          kwargs['context'] = [force_text(item) for item in context_list]          self.templates.append(kwargs) -    @classmethod -    def get_urls(cls): -        return patterns('debug_toolbar.panels.templates.views',         # noqa -            url(r'^template_source/$', 'template_source', name='template_source'), -        ) +    # Implement the Panel API -    def nav_title(self): -        return _('Templates') +    nav_title = _('Templates') +    @property      def title(self):          num_templates = len(self.templates)          return _('Templates (%(num_templates)s rendered)') % {'num_templates': num_templates} +    template = 'debug_toolbar/panels/templates.html' + +    @classmethod +    def get_urls(cls): +        return patterns('debug_toolbar.panels.templates.views',         # noqa +            url(r'^template_source/$', 'template_source', name='template_source'), +        ) +      def process_response(self, request, response):          context_processors = dict(              [ | 
