Skip to content

Commit d4b2b38

Browse files
authored
Merge pull request #859 from idlesign/feat/package_name
Package name column added to Versions panel (rebase).
2 parents 79bfc57 + d88a237 commit d4b2b38

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

debug_toolbar/panels/versions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import absolute_import, unicode_literals
22

33
import sys
4-
from collections import OrderedDict
54

65
import django
76
from django.apps import apps
@@ -24,12 +23,12 @@ def nav_subtitle(self):
2423

2524
def generate_stats(self, request, response):
2625
versions = [
27-
('Python', '%d.%d.%d' % sys.version_info[:3]),
28-
('Django', self.get_app_version(django)),
26+
('Python', '', '%d.%d.%d' % sys.version_info[:3]),
27+
('Django', '', self.get_app_version(django)),
2928
]
3029
versions += list(self.gen_app_versions())
3130
self.record_stats({
32-
'versions': OrderedDict(sorted(versions, key=lambda v: v[0])),
31+
'versions': sorted(versions, key=lambda v: v[0]),
3332
'paths': sys.path,
3433
})
3534

@@ -39,7 +38,7 @@ def gen_app_versions(self):
3938
app = app_config.module
4039
version = self.get_app_version(app)
4140
if version:
42-
yield name, version
41+
yield app.__name__, name, version
4342

4443
def get_app_version(self, app):
4544
if hasattr(app, 'get_version'):

debug_toolbar/templates/debug_toolbar/panels/versions.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
{% load i18n %}
22
<table>
3+
<col style="width:15%">
4+
<col style="width:15%">
35
<thead>
46
<tr>
7+
<th>{% trans "Package" %}</th>
58
<th>{% trans "Name" %}</th>
69
<th>{% trans "Version" %}</th>
710
</tr>
811
</thead>
912
<tbody>
10-
{% for package, version in versions.items %}
13+
{% for package, name, version in versions %}
1114
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
1215
<td>{{ package }}</td>
16+
<td>{{ name }}</td>
1317
<td>{{ version }}</td>
1418
</tr>
1519
{% endfor %}

0 commit comments

Comments
 (0)