From 85bd265bd5fe9dda44c67c2b2e618a79c2fb8fdc Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Fri, 23 Jan 2009 10:59:59 -0800 Subject: Add preliminary support for stacktraces to see where SQL queries are coming from. I'm wanting to test this a bit more before I merge it in fully. Feedback welcome.--- debug_toolbar/media/toolbar.js | 7 ++++++ debug_toolbar/media/toolbar.min.js | 2 +- debug_toolbar/panels/sql.py | 29 +++++++++++++++++++++- .../templates/debug_toolbar/panels/sql.html | 22 ++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) (limited to 'debug_toolbar') diff --git a/debug_toolbar/media/toolbar.js b/debug_toolbar/media/toolbar.js index b6baa2c..bff9b21 100644 --- a/debug_toolbar/media/toolbar.js +++ b/debug_toolbar/media/toolbar.js @@ -35,12 +35,19 @@ jQuery(function($) { }); $('#djDebugTemplatePanel a.djTemplateShowContext').click(function() { $.djDebug.toggle_content($(this).parent().next()); + return false; + }); + $('#djDebugSQLPanel a.djSQLShowStacktrace').click(function() { + $.djDebug.toggle_content($(this).parent().next()); + return false; }); $('#djHideToolBarButton').click(function() { $.djDebug.hide_toolbar(true); + return false; }); $('#djShowToolBarButton').click(function() { $.djDebug.show_toolbar(); + return false; }); if ($.cookie(COOKIE_NAME)) { $.djDebug.hide_toolbar(false); diff --git a/debug_toolbar/media/toolbar.min.js b/debug_toolbar/media/toolbar.min.js index 43bfead..4c8364e 100644 --- a/debug_toolbar/media/toolbar.min.js +++ b/debug_toolbar/media/toolbar.min.js @@ -1 +1 @@ -var _$=window.$;jQuery.noConflict();jQuery(function(a){var b="dj_debug_panel";a.djDebug=function(d,c){a.djDebug.init()};a.extend(a.djDebug,{init:function(){var c=null;a("#djDebugPanelList li a").click(function(){c=a("#djDebug #"+this.className);if(c.is(":visible")){a(document).trigger("close.djDebug")}else{a(".panelContent").hide();c.show();a.djDebug.open()}return false});a("#djDebug a.close").click(function(){a(document).trigger("close.djDebug");return false});a("#djDebug a.remoteCall").click(function(){a("#djDebugWindow").load(this.href,{},function(){a("#djDebugWindow a.back").click(function(){a(this).parent().hide();return false})});a("#djDebugWindow").show();return false});a("#djDebugTemplatePanel a.djTemplateShowContext").click(function(){a.djDebug.toggle_content(a(this).parent().next())});a("#djHideToolBarButton").click(function(){a.djDebug.hide_toolbar(true)});a("#djShowToolBarButton").click(function(){a.djDebug.show_toolbar()});if(a.cookie(b)){a.djDebug.hide_toolbar(false)}else{a("#djDebugToolbar").show()}},open:function(){a(document).bind("keydown.djDebug",function(c){if(c.keyCode==27){a.djDebug.close()}})},toggle_content:function(c){if(c.is(":visible")){c.hide()}else{c.show()}},close:function(){a(document).trigger("close.djDebug");return false},hide_toolbar:function(c){a("#djDebugToolbar").hide("fast");a("#djDebugToolbarHandle").show();if(c){a.cookie(b,"hide",{path:"/",expires:10})}},show_toolbar:function(){a("#djDebugToolbarHandle").hide();a("#djDebugToolbar").show("fast");a.cookie(b,null,{path:"/",expires:-1})}});a(document).bind("close.djDebug",function(){a(document).unbind("keydown.djDebug");a(".panelContent").hide()})});jQuery(function(){jQuery.djDebug()});$=_$;jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h Time (ms) Action + Stacktrace Query @@ -20,6 +21,27 @@ {% endif %} {% endif %} + + {% if query.stacktrace %} +
Toggle Stacktrace
+ + {% endif %} + {{ query.sql|safe }} {% endfor %} -- cgit v1.2.3