Skip to content

Commit 67f06f8

Browse files
committed
Sort versions alphabetically.
1 parent 77d108a commit 67f06f8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

debug_toolbar/panels/version.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import django
44
from django.conf import settings
55
from django.utils.translation import ugettext_lazy as _
6+
from django.utils.datastructures import SortedDict
67

78
from debug_toolbar.panels import DebugPanel
89

@@ -28,8 +29,7 @@ def title(self):
2829
return _('Versions')
2930

3031
def process_response(self, request, response):
31-
versions = {}
32-
versions['Python'] = '%d.%d.%d' % sys.version_info[:3]
32+
versions = [('Python', '%d.%d.%d' % sys.version_info[:3])]
3333
for app in list(settings.INSTALLED_APPS) + ['django']:
3434
name = app.split('.')[-1].replace('_', ' ').capitalize()
3535
__import__(app)
@@ -48,9 +48,10 @@ def process_response(self, request, response):
4848
continue
4949
if isinstance(version, (list, tuple)):
5050
version = '.'.join(str(o) for o in version)
51-
versions[name] = version
51+
versions.append((name, version))
52+
versions = sorted(versions, key=lambda version: version[0])
5253

5354
self.record_stats({
54-
'versions': versions,
55+
'versions': SortedDict(versions),
5556
'paths': sys.path,
5657
})

debug_toolbar/templates/debug_toolbar/panels/versions.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{% load i18n %}
2-
32
<table>
43
<thead>
54
<tr>
6-
<th>{% trans "Package" %}</th>
5+
<th>{% trans "Name" %}</th>
76
<th>{% trans "Version" %}</th>
87
</tr>
98
</thead>

0 commit comments

Comments
 (0)