From 8377ea179568c1fbf8f46db1234e85d689daae0a Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Thu, 11 Sep 2008 23:19:27 -0700 Subject: Adding JSON params to pass to view and adding link for explain. --- debug_toolbar/panels/sql.py | 3 ++- 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 @@ Time (ms) Query + Action {% for query in queries %} {{ query.time|floatformat:"4" }} -
{{ query.sql|escape }}
+
{{ query.sql|wordwrap:80|escape }}
+ EXPLAIN {% endfor %} -- cgit v1.2.3