aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar
diff options
context:
space:
mode:
authorRob Hudson2009-09-12 16:42:59 -0700
committerRob Hudson2009-09-12 16:42:59 -0700
commitb7d7e9f876b67be35d8a24405f6940b2dcb66e97 (patch)
tree572393460d9a6c4913ba2fcaeac94361e319746f /debug_toolbar
parent05ecb07d22be34651d60e2e1683c5ab96219d5fd (diff)
downloaddjango-debug-toolbar-b7d7e9f876b67be35d8a24405f6940b2dcb66e97.tar.bz2
Fixed to only show the link for requesting the SELECT data if the query is a
SELECT query.
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 17f4598..17130ca 100644
--- a/debug_toolbar/panels/sql.py
+++ b/debug_toolbar/panels/sql.py
@@ -106,7 +106,8 @@ class DatabaseStatTracker(util.CursorDebugWrapper):
'stacktrace': stacktrace,
'start_time': start,
'stop_time': stop,
- 'is_slow': (duration > SQL_WARNING_THRESHOLD)
+ 'is_slow': (duration > SQL_WARNING_THRESHOLD),
+ 'is_select': sql.lower().strip().startswith('select'),
})
util.CursorDebugWrapper = DatabaseStatTracker
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html
index 81188a9..ba8a2c3 100644
--- a/debug_toolbar/templates/debug_toolbar/panels/sql.html
+++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html
@@ -14,7 +14,9 @@
<td>{{ query.duration|floatformat:"2" }}</td>
<td>
{% if query.params %}
- <a class="remoteCall" href="/__debug__/sql_select/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">SELECT</a><br>
+ {% if query.is_select %}
+ <a class="remoteCall" href="/__debug__/sql_select/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">SELECT</a><br>
+ {% endif %}
<a class="remoteCall" href="/__debug__/sql_explain/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">EXPLAIN</a><br>
{% if is_mysql %}
<a class="remoteCall" href="/__debug__/sql_profile/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">PROFILE</a><br>