aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar
diff options
context:
space:
mode:
authorRob Hudson2008-09-11 23:19:27 -0700
committerRob Hudson2008-09-11 23:19:27 -0700
commit8377ea179568c1fbf8f46db1234e85d689daae0a (patch)
tree804da33e39a9d94a0cda48a3c9fcf91b631d3f1d /debug_toolbar
parent4ef51f1c912d49c7650126398c4ac38fef0f795c (diff)
downloaddjango-debug-toolbar-8377ea179568c1fbf8f46db1234e85d689daae0a.tar.bz2
Adding JSON params to pass to view and adding link for explain.
Diffstat (limited to 'debug_toolbar')
-rw-r--r--debug_toolbar/panels/sql.py3
-rw-r--r--debug_toolbar/templates/debug_toolbar/panels/sql.html4
2 files changed, 5 insertions, 2 deletions
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py
index 8edfce9..757505a 100644
--- a/debug_toolbar/panels/sql.py
+++ b/debug_toolbar/panels/sql.py
@@ -1,3 +1,4 @@
+import simplejson
import time
from debug_toolbar.panels import DebugPanel
from django.db import connection
@@ -20,7 +21,7 @@ class DatabaseStatTracker(util.CursorDebugWrapper):
'sql': self.db.ops.last_executed_query(self.cursor, sql, params),
'time': stop - start,
'raw_sql': sql,
- 'params': params,
+ 'params': simplejson.dumps(params),
})
util.CursorDebugWrapper = DatabaseStatTracker
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html
index 046be7f..9a6638b 100644
--- a/debug_toolbar/templates/debug_toolbar/panels/sql.html
+++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html
@@ -4,13 +4,15 @@
<tr>
<th>Time&nbsp;(ms)</th>
<th>Query</th>
+ <th>Action</th>
</tr>
</thead>
<tbody>
{% for query in queries %}
<tr class="{% cycle 'row1' 'row2' %}">
<td>{{ query.time|floatformat:"4" }}</td>
- <td><pre>{{ query.sql|escape }}</pre></td>
+ <td><pre>{{ query.sql|wordwrap:80|escape }}</pre></td>
+ <td><a href="{% url explain_sql %}?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&time={{ query.time|floatformat:"4"|urlencode }}">EXPLAIN</a></td>
</tr>
{% endfor %}
</tbody>