aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug_toolbar/panels/template.py7
-rw-r--r--debug_toolbar/templates/debug_toolbar/panels/templates.html18
2 files changed, 23 insertions, 2 deletions
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py
index eb20079..022a41f 100644
--- a/debug_toolbar/panels/template.py
+++ b/debug_toolbar/panels/template.py
@@ -2,6 +2,7 @@ from pprint import pformat
from django.conf import settings
from django.core.signals import request_started
from django.dispatch import Signal
+from django.template.context import get_standard_processors
from django.template.loader import render_to_string
from django.test.signals import template_rendered
from debug_toolbar.panels import DebugPanel
@@ -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)
diff --git a/debug_toolbar/templates/debug_toolbar/panels/templates.html b/debug_toolbar/templates/debug_toolbar/panels/templates.html
index 575d507..fa6bb5e 100644
--- a/debug_toolbar/templates/debug_toolbar/panels/templates.html
+++ b/debug_toolbar/templates/debug_toolbar/panels/templates.html
@@ -1,4 +1,4 @@
-<h3>Template path(s):</h3>
+<h3>Template path{{ template_dirs|pluralize }}</h3>
{% if template_dirs %}
<ol>
{% for template in template_dirs %}
@@ -8,7 +8,7 @@
{% else %}
None
{% endif %}
-<h3>Templates Used</h3>
+<h3>Template{{ templates|pluralize }}</h3>
{% if templates %}
<dl>
{% for template in templates %}
@@ -23,3 +23,17 @@
{% else %}
None
{% endif %}
+<h3>Context processor{{ context_processors|pluralize }}</h3>
+{% if context_processors %}
+<dl>
+{% for key, value in context_processors.iteritems %}
+ <dt><strong>{{ key|escape }}</strong></dt>
+ <dd>
+ <div class="djTemplateShowContextDiv"><a class="djTemplateShowContext">Toggle Context</a></div>
+ <div class="djTemplateHideContextDiv" style="display:none;"><pre>{{ value|escape }}</pre></div>
+ </dd>
+{% endfor %}
+</dl>
+{% else %}
+ None
+{% endif %}