bgneal@1: from django.db import connection bgneal@1: from django.template import Template, Context bgneal@1: bgneal@1: class SQLLogMiddleware: bgneal@1: bgneal@1: def process_response ( self, request, response ): bgneal@1: time = 0.0 bgneal@1: for q in connection.queries: bgneal@1: time += float(q['time']) bgneal@1: t = Template(''' bgneal@1:
Total query count: {{ count }}
bgneal@1: Total execution time: {{ time }}