diff options
| author | Rob Hudson | 2008-08-27 23:57:17 -0700 | 
|---|---|---|
| committer | Rob Hudson | 2008-08-27 23:57:17 -0700 | 
| commit | ab06fbe6bf60be18a740547db957b5c44ae6b786 (patch) | |
| tree | 0c424715d0b8d5f4abb1ffe3214adf599ff09f08 /debug_toolbar/panels/sql.py | |
| download | django-debug-toolbar-ab06fbe6bf60be18a740547db957b5c44ae6b786.tar.bz2 | |
Initial commit of basic working Debug Toolbar (that needs a lot of CSS and JS love)
Diffstat (limited to 'debug_toolbar/panels/sql.py')
| -rw-r--r-- | debug_toolbar/panels/sql.py | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py new file mode 100644 index 0000000..6c180d7 --- /dev/null +++ b/debug_toolbar/panels/sql.py @@ -0,0 +1,19 @@ +from debug_toolbar.panels import DebugPanel + +class SQLDebugPanel(DebugPanel): +    """ +    Panel that displays information about the SQL queries run while processing the request. +    """ +    def title(self): +        return 'SQL Queries' + +    def url(self): +        return '' + +    def content(self): +        from django.db import connection +        query_info = [] +        for q in connection.queries: +            query_info.append('<dt>%s</dt><dd>%s</dd>' % (q['time'], q['sql'])) +        return '<dl>%s</dl>' % (''.join(query_info)) + | 
