aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/panels/sql.py
blob: d699e1ae178a06c10c25edfeb3d821b3c5295fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from debug_toolbar.panels import DebugPanel
from django.db import connection
from django.template.loader import render_to_string

class SQLDebugPanel(DebugPanel):
    """
    Panel that displays information about the SQL queries run while processing the request.
    """
    name = 'SQL'
    
    def title(self):
        return '%d SQL Queries' % (len(connection.queries))

    def url(self):
        return ''

    def content(self):
        context = {'queries': connection.queries}
        return render_to_string('debug_toolbar/panels/sql.html', context)