aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug_toolbar/panels/http_vars.py21
-rw-r--r--debug_toolbar/templates/debug_toolbar/panels/headers.html16
-rw-r--r--debug_toolbar/templates/debug_toolbar/panels/http_vars.html42
-rw-r--r--debug_toolbar/templates/debug_toolbar/panels/sql.html16
4 files changed, 95 insertions, 0 deletions
diff --git a/debug_toolbar/panels/http_vars.py b/debug_toolbar/panels/http_vars.py
new file mode 100644
index 0000000..98d5fc8
--- /dev/null
+++ b/debug_toolbar/panels/http_vars.py
@@ -0,0 +1,21 @@
+from django.template.loader import render_to_string
+from debug_toolbar.panels import DebugPanel
+
+class HttpVarsDebugPanel(DebugPanel):
+ """
+ A panel to display HTTP variables (POST/GET).
+ """
+ name = 'HttpVars'
+
+ def title(self):
+ return 'POST/GET'
+
+ def url(self):
+ return ''
+
+ def content(self):
+ context = {
+ 'get': [(k, self.request.GET.getlist(k)) for k in self.request.GET.iterkeys()],
+ 'post': [(k, self.request.POST.getlist(k)) for k in self.request.POST.iterkeys()]
+ }
+ return render_to_string('debug_toolbar/panels/http_vars.html', context) \ No newline at end of file
diff --git a/debug_toolbar/templates/debug_toolbar/panels/headers.html b/debug_toolbar/templates/debug_toolbar/panels/headers.html
new file mode 100644
index 0000000..61c6b83
--- /dev/null
+++ b/debug_toolbar/templates/debug_toolbar/panels/headers.html
@@ -0,0 +1,16 @@
+<table>
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for key, value in headers.iteritems %}
+ <tr class="{% cycle 'row1' 'row2' %}">
+ <td>{{ key|escape }}</td>
+ <td>{{ value|escape }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table> \ No newline at end of file
diff --git a/debug_toolbar/templates/debug_toolbar/panels/http_vars.html b/debug_toolbar/templates/debug_toolbar/panels/http_vars.html
new file mode 100644
index 0000000..44f3497
--- /dev/null
+++ b/debug_toolbar/templates/debug_toolbar/panels/http_vars.html
@@ -0,0 +1,42 @@
+<div class="title">GET Variables</div>
+{% if get %}
+ <table>
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for key, value in get %}
+ <tr class="{% cycle 'row1' 'row2' %}">
+ <td>{{ key|escape }}</td>
+ <td>{{ value|join:", "|escape }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+{% else %}
+ <p>None</p>
+{% endif %}
+<div class="title">POST Variables</div>
+{% if post %}
+ <table>
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for key, value in post %}
+ <tr class="{% cycle 'row1' 'row2' %}">
+ <td>{{ key|escape }}</td>
+ <td>{{ value|join:", "|escape }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+{% else %}
+ <p>None</p>
+{% endif %} \ No newline at end of file
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html
new file mode 100644
index 0000000..3d6a966
--- /dev/null
+++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html
@@ -0,0 +1,16 @@
+<table>
+ <thead>
+ <tr>
+ <th>Time&nbsp;(ms)</th>
+ <th>Query</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for query in queries %}
+ <tr class="{% cycle 'row1' 'row2' %}">
+ <td>{{ query.time|floatformat:"4" }}</td>
+ <td>{{ query.sql|escape }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table> \ No newline at end of file