Files
mayan-edms/mayan/apps/smart_settings/apps.py
Roberto Rosario 8179c35189 Simplify test runner by adding a new option '--mayan-apps' that
automatically tests all Mayan apps that report to have tests.
Change the app flag that indicates when an app has test
from 'test' to the more explicit 'has_test'.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-03-14 23:47:40 -04:00

41 lines
1.2 KiB
Python

from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from common import MayanAppConfig, menu_setup, menu_object
from navigation import SourceColumn
from .classes import Namespace, Setting
from .links import link_namespace_detail, link_namespace_list
from .widgets import setting_widget
class SmartSettingsApp(MayanAppConfig):
app_namespace = 'settings'
app_url = 'settings'
has_tests = True
name = 'smart_settings'
verbose_name = _('Smart settings')
def ready(self):
super(SmartSettingsApp, self).ready()
Namespace.initialize()
SourceColumn(
source=Namespace, label=_('Setting count'),
func=lambda context: len(context['object'].settings)
)
SourceColumn(
source=Setting, label=_('Name'),
func=lambda context: setting_widget(context['object'])
)
SourceColumn(
source=Setting, label=_('Value'), attribute='serialized_value'
)
menu_object.bind_links(
links=(link_namespace_detail,), sources=(Namespace,)
)
menu_setup.bind_links(links=(link_namespace_list,))