aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/views.py
diff options
context:
space:
mode:
authorVladislav Poluhin2013-04-24 15:54:17 +0800
committerVladislav Poluhin2013-04-24 15:54:17 +0800
commit4c1c4f7a8873a80f843ba683240b9d0ff0f49e4b (patch)
tree4840de7ec2ec41d1ef7cc362803c2d0ace58d663 /debug_toolbar/views.py
parent3d0467d9a4394c4b994a802e6e861ff2562dbb2b (diff)
parent6f79f0b0ada69e1d95d97066ba78e0d18aeab3ba (diff)
downloaddjango-debug-toolbar-4c1c4f7a8873a80f843ba683240b9d0ff0f49e4b.tar.bz2
Merge branch 'master' of https://github.com/django-debug-toolbar/django-debug-toolbar into sql-panel-refactor
Conflicts: debug_toolbar/static/debug_toolbar/css/toolbar.min.css debug_toolbar/views.py
Diffstat (limited to 'debug_toolbar/views.py')
-rw-r--r--debug_toolbar/views.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/debug_toolbar/views.py b/debug_toolbar/views.py
index 13a36b1..ee650ba 100644
--- a/debug_toolbar/views.py
+++ b/debug_toolbar/views.py
@@ -9,8 +9,13 @@ from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
try:
+ import json
+except ImportError: # python < 2.6
+ from django.utils import simplejson as json
+
+try:
from hashlib import sha1
-except ImportError:
+except ImportError: # python < 2.5
from django.utils.hashcompat import sha_constructor as sha1
from debug_toolbar.forms import SQLSelectForm
@@ -58,6 +63,8 @@ def sql_explain(request):
# EXPLAIN QUERY PLAN dumps a more human-readable summary
# See http://www.sqlite.org/lang_explain.html for details
cursor.execute("EXPLAIN QUERY PLAN %s" % (sql,), params)
+ elif engine == "psycopg2":
+ cursor.execute("EXPLAIN ANALYZE %s" % (sql,), params)
else:
cursor.execute("EXPLAIN %s" % (sql,), params)