diff options
| author | Rob Hudson | 2008-09-11 23:19:27 -0700 |
|---|---|---|
| committer | Rob Hudson | 2008-09-11 23:19:27 -0700 |
| commit | 8377ea179568c1fbf8f46db1234e85d689daae0a (patch) | |
| tree | 804da33e39a9d94a0cda48a3c9fcf91b631d3f1d | |
| parent | 4ef51f1c912d49c7650126398c4ac38fef0f795c (diff) | |
| download | django-debug-toolbar-8377ea179568c1fbf8f46db1234e85d689daae0a.tar.bz2 | |
Adding JSON params to pass to view and adding link for explain.
| -rw-r--r-- | debug_toolbar/panels/sql.py | 3 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/sql.html | 4 |
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 (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 }}¶ms={{ query.params|urlencode }}&time={{ query.time|floatformat:"4"|urlencode }}">EXPLAIN</a></td> </tr> {% endfor %} </tbody> |
