diff options
| author | Rob Hudson | 2008-09-07 00:30:38 -0700 |
|---|---|---|
| committer | Rob Hudson | 2008-09-07 00:30:38 -0700 |
| commit | d85509edab8290666d056ba5f0a9423feceb64d5 (patch) | |
| tree | 90cf9fb080cc77c282cecdfd75a4bde150331984 /debug_toolbar/panels | |
| parent | 1d309f8a3a9c0ad76c22e0e2a0600459ea8d88f0 (diff) | |
| download | django-debug-toolbar-d85509edab8290666d056ba5f0a9423feceb64d5.tar.bz2 | |
converting sql panel to use template
Diffstat (limited to 'debug_toolbar/panels')
| -rw-r--r-- | debug_toolbar/panels/sql.py | 15 |
1 files changed, 11 insertions, 4 deletions
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('<dt><strong>%s</strong></dt><dd>%s</dd>' % (q['time'], q['sql'])) - return '<dl>%s</dl>' % (''.join(query_info)) + t = Template(''' + <dl> + {% for q in queries %} + <dt><strong>{{ q.time }}</strong></dt> + <dd>{{ q.sql }}</dd> + {% endfor %} + </dl> + ''') + c = Context({'queries': connection.queries}) + return t.render(c) |
