From d85509edab8290666d056ba5f0a9423feceb64d5 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Sun, 7 Sep 2008 00:30:38 -0700 Subject: converting sql panel to use template --- debug_toolbar/panels/sql.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'debug_toolbar/panels') diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index 9b50c93..c1c9f1a 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -1,5 +1,6 @@ from debug_toolbar.panels import DebugPanel from django.db import connection +from django.template import Context, Template class SQLDebugPanel(DebugPanel): """ @@ -12,7 +13,13 @@ class SQLDebugPanel(DebugPanel): return '' def content(self): - query_info = [] - for q in connection.queries: - query_info.append('
%s
%s
' % (q['time'], q['sql'])) - return '
%s
' % (''.join(query_info)) + t = Template(''' +
+ {% for q in queries %} +
{{ q.time }}
+
{{ q.sql }}
+ {% endfor %} +
+ ''') + c = Context({'queries': connection.queries}) + return t.render(c) -- cgit v1.2.3