Ticket #1979: debug_queries.diff
File debug_queries.diff, 1.4 KB (added by , 18 years ago) |
---|
-
debug.py
2 2 from django.template import Template, Context, TemplateDoesNotExist 3 3 from django.utils.html import escape 4 4 from django.http import HttpResponseServerError, HttpResponseNotFound 5 from django.db import connection 5 6 import os, re 6 7 from itertools import count, izip 7 8 from os.path import dirname, join as pathjoin … … 120 121 'request': request, 121 122 'request_protocol': os.environ.get("HTTPS") == "on" and "https" or "http", 122 123 'settings': get_safe_settings(), 124 'database_queries' : connection.queries, 123 125 'template_info': template_info, 124 126 'template_does_not_exist': template_does_not_exist, 125 127 'loader_debug_info': loader_debug_info, … … 522 524 {% endfor %} 523 525 </tbody> 524 526 </table> 525 527 528 <h3>Queries</h3> 529 {% if database_queries %} 530 <table class="req"> 531 <thead> 532 <tr> 533 <th>Duration</th> 534 <th>Query</th> 535 </tr> 536 </thead> 537 <tbody> 538 {% for var in database_queries %} 539 <tr> 540 <td>{{ var.time }}</td> 541 <td class="code"><div>{{ var.sql|escape }}</div></td> 542 </tr> 543 {% endfor %} 544 </tbody> 545 </table> 546 {% else %} 547 <p>No Query data</p> 548 {% endif %} 549 526 550 </div> 527 551 528 552 <div id="explanation">