aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar
diff options
context:
space:
mode:
authorRob Hudson2008-09-20 15:54:22 -0700
committerRob Hudson2008-09-20 15:54:22 -0700
commit7f9f7e529f67f46390cf9c3d43813e96908306bf (patch)
treebfb1a04973f0a00f9ae4a3efa0f0d22fc435618b /debug_toolbar
parent6bd25be6b8345f0a08c99acc35877faafd2a08ee (diff)
parentb9bd4c0cb9aa595c2648d43fce49961139f46971 (diff)
downloaddjango-debug-toolbar-7f9f7e529f67f46390cf9c3d43813e96908306bf.tar.bz2
finishing up ajax work for sql explain
Diffstat (limited to 'debug_toolbar')
-rw-r--r--debug_toolbar/media/toolbar.js58
-rw-r--r--debug_toolbar/panels/sql.py2
-rw-r--r--debug_toolbar/panels/template.py4
-rw-r--r--debug_toolbar/views.py2
4 files changed, 32 insertions, 34 deletions
diff --git a/debug_toolbar/media/toolbar.js b/debug_toolbar/media/toolbar.js
index 7d2f6b5..19a6abf 100644
--- a/debug_toolbar/media/toolbar.js
+++ b/debug_toolbar/media/toolbar.js
@@ -1,43 +1,44 @@
jQuery.noConflict();
-jQuery(function() {
- jQuery.djDebug = function(data, klass) {
- jQuery.djDebug.init();
+jQuery(function($) {
+ $.djDebug = function(data, klass) {
+ $.djDebug.init();
}
- jQuery.extend(jQuery.djDebug, {
+ $.extend($.djDebug, {
init: function() {
var current = null;
- jQuery('#djDebugPanelList li a').click(function() {
- current = jQuery('#djDebug #' + this.className);
+ $('#djDebugPanelList li a').click(function() {
+ current = $('#djDebug #' + this.className);
if (current.is(':visible')) {
- jQuery(document).trigger('close.djDebug');
+ $(document).trigger('close.djDebug');
} else {
- jQuery('.panelContent').hide();
+ $('.panelContent').hide();
current.show();
- jQuery.djDebug.open();
+ $.djDebug.open();
}
return false;
});
- jQuery('#djDebug a.close').click(function() {
- jQuery(document).trigger('close.djDebug');
- return false;
- });
- jQuery('#djDebugWindow a.back').click(function() {
- console.dir(jQuery(this).parent());
- jQuery(this).parent().hide();
+ $('#djDebug a.close').click(function() {
+ $(document).trigger('close.djDebug');
return false;
});
- jQuery('#djDebug a.remoteCall').click(function() {
- jQuery.djDebug.remote_call(this);
+ $('#djDebug a.remoteCall').click(function() {
+ $('#djDebugWindow').load(this.href, {}, function() {
+ $('#djDebugWindow a.back').click(function() {
+ $(this).parent().hide();
+ return false;
+ });
+ });
+ $('#djDebugWindow').show();
return false;
});
- jQuery('#djDebugTemplatePanel a.djTemplateShowContext').click(function() {
- jQuery.djDebug.toggle_content(jQuery(this).parent().next());
+ $('#djDebugTemplatePanel a.djTemplateShowContext').click(function() {
+ $.djDebug.toggle_content($(this).parent().next());
});
},
open: function() {
- jQuery(document).bind('keydown.djDebug', function(e) {
+ $(document).bind('keydown.djDebug', function(e) {
if (e.keyCode == 27) {
- jQuery.djDebug.close();
+ $.djDebug.close();
}
});
},
@@ -48,21 +49,16 @@ jQuery(function() {
elem.show();
}
},
- remote_call: function(obj) {
- jQuery('#djDebugWindow').load(obj.href).show();
-
- },
close: function() {
- jQuery(document).trigger('close.djDebug');
+ $(document).trigger('close.djDebug');
return false;
}
});
- jQuery(document).bind('close.djDebug', function() {
- jQuery(document).unbind('keydown.djDebug');
- jQuery('.panelContent').hide();
+ $(document).bind('close.djDebug', function() {
+ $(document).unbind('keydown.djDebug');
+ $('.panelContent').hide();
});
});
-
jQuery(function() {
jQuery.djDebug();
});
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py
index 757505a..cdcbd1b 100644
--- a/debug_toolbar/panels/sql.py
+++ b/debug_toolbar/panels/sql.py
@@ -1,9 +1,9 @@
-import simplejson
import time
from debug_toolbar.panels import DebugPanel
from django.db import connection
from django.db.backends import util
from django.template.loader import render_to_string
+from django.utils import simplejson
class DatabaseStatTracker(util.CursorDebugWrapper):
"""
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py
index bda6630..e08f220 100644
--- a/debug_toolbar/panels/template.py
+++ b/debug_toolbar/panels/template.py
@@ -5,6 +5,8 @@ from django.template.loader import render_to_string
from django.test.signals import template_rendered
from debug_toolbar.panels import DebugPanel
+from pprint import pformat
+
# Code taken and adapted from Simon Willison and Django Snippets:
# http://www.djangosnippets.org/snippets/766/
@@ -60,7 +62,7 @@ class TemplateDebugPanel(DebugPanel):
info['template'] = t
# Clean up context for better readability
c = d.get('context', None)
- info['context'] = '\n'.join([_d.__repr__() for _d in c.dicts])
+ info['context'] = '\n'.join([pformat(_d) for _d in c.dicts])
template_context.append(info)
context = {
'templates': template_context,
diff --git a/debug_toolbar/views.py b/debug_toolbar/views.py
index 1b44ed1..97739e6 100644
--- a/debug_toolbar/views.py
+++ b/debug_toolbar/views.py
@@ -5,11 +5,11 @@ views in any other way is generally not advised.
"""
import os
-import simplejson
import django.views.static
from django.conf import settings
from django.db import connection
from django.shortcuts import render_to_response
+from django.utils import simplejson
def debug_media(request, path):
root = getattr(settings, 'DEBUG_TOOLBAR_MEDIA_ROOT', None)