Print openslides version number in separat config template.

This commit is contained in:
Emanuel Schuetze 2012-04-15 10:36:37 +02:00
parent 5f2c778880
commit c07c2ac853
5 changed files with 37 additions and 9 deletions

View File

@ -101,10 +101,10 @@ from openslides.utils.signals import template_manipulation
def set_submenu(sender, request, context, **kwargs):
if not request.path.startswith('/config/'):
return None
selected = True if request.path == reverse('config_general') else False
menu_links = [
(reverse('config_general'), _('General'), selected),
(reverse('config_general'), _('General'), request.path == reverse('config_general') ),
]
for app in settings.INSTALLED_APPS:
try:
mod = import_module(app + '.views')
@ -118,9 +118,10 @@ def set_submenu(sender, request, context, **kwargs):
(reverse('config_%s' % appname), _(appname.title()), selected)
)
menu_links.append (
(reverse('config_version'), _('Version'), request.path == reverse('config_version') )
)
context.update({
'menu_links': menu_links,
})

View File

@ -0,0 +1,11 @@
{% extends "config/base_config.html" %}
{% load i18n %}
{% block title %}{{ block.super }} - {% trans "Version" %}{% endblock %}
{% block content %}
<h1>{% trans "Version" %}</h1>
<p>{% trans "OpenSlides Version" %}: {{ version }}</p>
{% endblock %}

View File

@ -15,13 +15,18 @@ from django.utils.importlib import import_module
import settings
from views import GeneralConfig
from views import GeneralConfig, VersionConfig
urlpatterns = patterns('config.views',
url(r'^general/$',
GeneralConfig.as_view(),
name='config_general',
),
url(r'^version/$',
VersionConfig.as_view(),
name='config_version',
),
)
for app in settings.INSTALLED_APPS:

View File

@ -17,8 +17,10 @@ from django.contrib.auth.models import Group, Permission
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string
from openslides import get_version
from utils.utils import template, permission_required
from utils.views import FormView
from utils.views import FormView, TemplateView
from utils.template import Tab
from forms import SystemConfigForm, EventConfigForm
@ -54,6 +56,16 @@ class GeneralConfig(FormView):
return super(Config, self).form_invalid(form)
class VersionConfig(TemplateView):
permission_required = 'config.can_manage_config'
template_name = 'config/version.html'
def get_context_data(self, **kwargs):
context = super(VersionConfig, self).get_context_data(**kwargs)
context['version'] = get_version()
return context
class Config(FormView):
permission_required = 'config.can_manage_config'
form_class = SystemConfigForm

View File

@ -67,8 +67,7 @@
{% endblock %}
<div id="footer">
<small>
&copy; Copyright 2011 | Powered by <a href="http://openslides.org">OpenSlides</a><br />
Version: {{ openslides_version }}
&copy; Copyright 2011 | Powered by <a href="http://openslides.org">OpenSlides</a>
</small>
</div>
</div>