Skip to content

Package name column added to Versions panel (rebase). #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions debug_toolbar/panels/versions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import absolute_import, unicode_literals

import sys
from collections import OrderedDict

import django
from django.apps import apps
Expand All @@ -24,12 +23,12 @@ def nav_subtitle(self):

def generate_stats(self, request, response):
versions = [
('Python', '%d.%d.%d' % sys.version_info[:3]),
('Django', self.get_app_version(django)),
('Python', '', '%d.%d.%d' % sys.version_info[:3]),
('Django', '', self.get_app_version(django)),
]
versions += list(self.gen_app_versions())
self.record_stats({
'versions': OrderedDict(sorted(versions, key=lambda v: v[0])),
'versions': sorted(versions, key=lambda v: v[0]),
'paths': sys.path,
})

Expand All @@ -39,7 +38,7 @@ def gen_app_versions(self):
app = app_config.module
version = self.get_app_version(app)
if version:
yield name, version
yield app.__name__, name, version

def get_app_version(self, app):
if hasattr(app, 'get_version'):
Expand Down
6 changes: 5 additions & 1 deletion debug_toolbar/templates/debug_toolbar/panels/versions.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{% load i18n %}
<table>
<col style="width:15%">
<col style="width:15%">
<thead>
<tr>
<th>{% trans "Package" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Version" %}</th>
</tr>
</thead>
<tbody>
{% for package, version in versions.items %}
{% for package, name, version in versions %}
<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
<td>{{ package }}</td>
<td>{{ name }}</td>
<td>{{ version }}</td>
</tr>
{% endfor %}
Expand Down