diff options
| author | Jannis Leidel | 2008-09-24 12:40:02 +0200 | 
|---|---|---|
| committer | Jannis Leidel | 2008-09-24 12:40:02 +0200 | 
| commit | d74431411b5c390379bcac89a60628a26365d8c9 (patch) | |
| tree | 32969f694832244a68b4b7da4d9b9af3991798be /debug_toolbar/panels/template.py | |
| parent | 39ceacf7c90a984efe21d3d67d30767ffcb97497 (diff) | |
| download | django-debug-toolbar-d74431411b5c390379bcac89a60628a26365d8c9.tar.bz2 | |
Added context processors to TemplateDebugPanel
Diffstat (limited to 'debug_toolbar/panels/template.py')
| -rw-r--r-- | debug_toolbar/panels/template.py | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py index eb20079..9cab618 100644 --- a/debug_toolbar/panels/template.py +++ b/debug_toolbar/panels/template.py @@ -4,6 +4,7 @@ from django.core.signals import request_started  from django.dispatch import Signal  from django.template.loader import render_to_string  from django.test.signals import template_rendered +from django.template.context import get_standard_processors  from debug_toolbar.panels import DebugPanel  # Code taken and adapted from Simon Willison and Django Snippets: @@ -44,6 +45,11 @@ class TemplateDebugPanel(DebugPanel):      def url(self):          return '' +    def process_request(self, request): +        self.context_processors = dict( +            [("%s.%s" % (k.__module__, k.__name__), pformat(k(request))) for k in get_standard_processors()] +        ) +      def content(self):          template_context = []          for i, d in enumerate(self.templates): @@ -65,5 +71,6 @@ class TemplateDebugPanel(DebugPanel):          context = {              'templates': template_context,              'template_dirs': settings.TEMPLATE_DIRS, +            'context_processors': self.context_processors,          }          return render_to_string('debug_toolbar/panels/templates.html', context)  | 
