From ca24b3f27510319319dca205f9c1e9868259e246 Mon Sep 17 00:00:00 2001
From: Tomasz Buchert
Date: Fri, 3 Jun 2011 10:41:05 +0200
Subject: [PATCH 1/2] Proper decimal separator for non-US locales (eg. polish).
---
debug_toolbar/templates/debug_toolbar/panels/sql.html | 3 ++-
debug_toolbar/templatetags/__init__.py | 0
debug_toolbar/templatetags/debug_toolbar_utils.py | 11 +++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 debug_toolbar/templatetags/__init__.py
create mode 100644 debug_toolbar/templatetags/debug_toolbar_utils.py
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html
index f6f231c62..deb439141 100644
--- a/debug_toolbar/templates/debug_toolbar/panels/sql.html
+++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html
@@ -1,4 +1,5 @@
{% load i18n %}
+{% load debug_toolbar_utils %}
{% for alias, info in databases %}
@@ -34,7 +35,7 @@
-
+
|
{{ query.duration|floatformat:"2" }}
diff --git a/debug_toolbar/templatetags/__init__.py b/debug_toolbar/templatetags/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/debug_toolbar/templatetags/debug_toolbar_utils.py b/debug_toolbar/templatetags/debug_toolbar_utils.py
new file mode 100644
index 000000000..6b204eba1
--- /dev/null
+++ b/debug_toolbar/templatetags/debug_toolbar_utils.py
@@ -0,0 +1,11 @@
+
+from django import template
+from django.utils.numberformat import format
+
+register = template.Library()
+
+@register.filter
+def dotted_number(number):
+ number = float(number)
+ return format(number, '.', 6)
+
From 9d32eb2c36f353565ee5738cd92805c1ea11d742 Mon Sep 17 00:00:00 2001
From: Tomasz Buchert
Date: Thu, 9 Jun 2011 10:52:38 +0200
Subject: [PATCH 2/2] Timeline width in SQL panel properly scaled.
---
debug_toolbar/panels/sql.py | 2 ++
debug_toolbar/templates/debug_toolbar/panels/sql.html | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py
index c6b59963f..bce769a71 100644
--- a/debug_toolbar/panels/sql.py
+++ b/debug_toolbar/panels/sql.py
@@ -183,8 +183,10 @@ def content(self):
query['rgb_color'] = self._databases[alias]['rgb_color']
try:
query['width_ratio'] = (query['duration'] / self._sql_time) * 100
+ query['width_ratio_relative'] = 100.0 * query['width_ratio'] / (100.0 - width_ratio_tally)
except ZeroDivisionError:
query['width_ratio'] = 0
+ query['width_ratio_relative'] = 0
query['start_offset'] = width_ratio_tally
query['end_offset'] = query['width_ratio'] + query['start_offset']
width_ratio_tally += query['width_ratio']
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html
index deb439141..9b282ca80 100644
--- a/debug_toolbar/templates/debug_toolbar/panels/sql.html
+++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html
@@ -35,7 +35,7 @@
|
-
+
|
{{ query.duration|floatformat:"2" }}
|