diff options
Diffstat (limited to 'debug_toolbar/panels')
| -rw-r--r-- | debug_toolbar/panels/__init__.py | 14 | ||||
| -rw-r--r-- | debug_toolbar/panels/sql.py | 19 | ||||
| -rw-r--r-- | debug_toolbar/panels/version.py | 15 |
3 files changed, 48 insertions, 0 deletions
diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py new file mode 100644 index 0000000..2454c56 --- /dev/null +++ b/debug_toolbar/panels/__init__.py @@ -0,0 +1,14 @@ +"""Base DebugPanel class""" + +class DebugPanel(object): + """ + Base class for debug panels. + """ + def title(self): + raise NotImplementedError + + def url(self): + raise NotImplementedError + + def content(self): + raise NotImplementedError 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)) + diff --git a/debug_toolbar/panels/version.py b/debug_toolbar/panels/version.py new file mode 100644 index 0000000..63c44b0 --- /dev/null +++ b/debug_toolbar/panels/version.py @@ -0,0 +1,15 @@ +import django +from debug_toolbar.panels import DebugPanel + +class VersionDebugPanel(DebugPanel): + """ + Panel that displays the Django version. + """ + def title(self): + return 'Version' + + def url(self): + return '' + + def content(self): + return django.get_version() |
