show version from plugins

This commit is contained in:
Oskar Hahn 2012-04-18 09:33:09 +02:00
parent 040b5ffb45
commit be6a63e48c
2 changed files with 19 additions and 3 deletions

View File

@ -7,5 +7,7 @@
{% block content %}
<h1>{% trans "Version" %}</h1>
<p>{% trans "OpenSlides Version" %}: {{ version }}</p>
{% for version in versions %}
<p>{{ version.0 }} {% trans "Version" %}: {{ version.1 }}</p>
{% endfor %}
{% endblock %}

View File

@ -16,6 +16,8 @@ from django.contrib import messages
from django.contrib.auth.models import Group, Permission
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string
from django.utils.importlib import import_module
import settings
from openslides import get_version
@ -25,7 +27,6 @@ from utils.template import Tab
from forms import GeneralConfigForm
from models import config
@ -85,7 +86,20 @@ class VersionConfig(TemplateView):
def get_context_data(self, **kwargs):
context = super(VersionConfig, self).get_context_data(**kwargs)
context['version'] = get_version()
context['versions'] = [('OpenSlides', get_version())]
for plugin in settings.INSTALLED_PLUGINS:
try:
mod = import_module(plugin)
plugin_version = get_version(mod.VERSION)
except (ImportError, AttributeError, AssertionError):
continue
try:
plugin_name = mod.NAME
except AttributeError:
plugin_name = mod.__name__.split('.')[0]
context['versions'].append((plugin_name, plugin_version))
return context