use plugin.NAME for submenu-title in config-tab

This commit is contained in:
Oskar Hahn 2012-04-16 11:36:50 +02:00
parent 80c5bfbba9
commit 3bceca2359

View File

@ -96,7 +96,6 @@ import settings
from openslides.utils.signals import template_manipulation from openslides.utils.signals import template_manipulation
@receiver(template_manipulation, dispatch_uid="config_submenu") @receiver(template_manipulation, dispatch_uid="config_submenu")
def set_submenu(sender, request, context, **kwargs): def set_submenu(sender, request, context, **kwargs):
if not request.path.startswith('/config/'): if not request.path.startswith('/config/'):
@ -107,15 +106,20 @@ def set_submenu(sender, request, context, **kwargs):
for app in settings.INSTALLED_APPS: for app in settings.INSTALLED_APPS:
try: try:
mod = import_module(app + '.views') mod = import_module(app)
mod.Config views = mod.views
views.Config
except (ImportError, AttributeError): except (ImportError, AttributeError):
continue continue
appname = mod.__name__.split('.')[0] appname = mod.__name__.split('.')[0]
selected = True if reverse('config_%s' % appname) == request.path else False selected = reverse('config_%s' % appname) == request.path
try:
title = mod.NAME
except AttributeError:
title = appname.title()
menu_links.append( menu_links.append(
(reverse('config_%s' % appname), _(appname.title()), selected) (reverse('config_%s' % appname), _(title), selected)
) )
menu_links.append ( menu_links.append (