From ff98fc6b8ac74e3f49f2edeaaa4d8cbb6a5c4cf2 Mon Sep 17 00:00:00 2001
From: Rob Hudson
Date: Mon, 8 Sep 2008 10:18:41 -0700
Subject: HTTP POST/GET panel contributed by David Cramer
---
debug_toolbar/panels/http_vars.py | 21 +++++++++++
.../templates/debug_toolbar/panels/headers.html | 16 +++++++++
.../templates/debug_toolbar/panels/http_vars.html | 42 ++++++++++++++++++++++
.../templates/debug_toolbar/panels/sql.html | 16 +++++++++
4 files changed, 95 insertions(+)
create mode 100644 debug_toolbar/panels/http_vars.py
create mode 100644 debug_toolbar/templates/debug_toolbar/panels/headers.html
create mode 100644 debug_toolbar/templates/debug_toolbar/panels/http_vars.html
create mode 100644 debug_toolbar/templates/debug_toolbar/panels/sql.html
(limited to 'debug_toolbar')
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 @@
+
+
+
+ | Key |
+ Value |
+
+
+
+ {% for key, value in headers.iteritems %}
+
+ | {{ key|escape }} |
+ {{ value|escape }} |
+
+ {% endfor %}
+
+
\ 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 @@
+GET Variables
+{% if get %}
+
+
+
+ | Key |
+ Value |
+
+
+
+ {% for key, value in get %}
+
+ | {{ key|escape }} |
+ {{ value|join:", "|escape }} |
+
+ {% endfor %}
+
+
+{% else %}
+ None
+{% endif %}
+POST Variables
+{% if post %}
+
+
+
+ | Key |
+ Value |
+
+
+
+ {% for key, value in post %}
+
+ | {{ key|escape }} |
+ {{ value|join:", "|escape }} |
+
+ {% endfor %}
+
+
+{% else %}
+ None
+{% 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 @@
+
+
+
+ | Time (ms) |
+ Query |
+
+
+
+ {% for query in queries %}
+
+ | {{ query.time|floatformat:"4" }} |
+ {{ query.sql|escape }} |
+
+ {% endfor %}
+
+
\ No newline at end of file
--
cgit v1.2.3