Make setting overriding more clear

Add better text explanation. Change the column to a check mark widget.
Helps GitLab issue #702.

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-12-08 14:54:48 -04:00
parent 15b4df54bf
commit 84bad05807
3 changed files with 13 additions and 3 deletions

View File

@@ -10,6 +10,9 @@
- Add test for GitLab issue #702
- Don't set SourceColumns to the attribute name when no help text
is defined.
- Make it clear when a setting is being overrided by an environment
variable. Add better text explanation. Change the column to a check
mark widget.
3.3.3 (2019-12-05)
==================

View File

@@ -3,6 +3,7 @@ from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.apps import MayanAppConfig
from mayan.apps.common.html_widgets import TwoStateWidget
from mayan.apps.common.menus import menu_secondary, menu_setup, menu_object
from mayan.apps.navigation.classes import SourceColumn
@@ -35,11 +36,10 @@ class SmartSettingsApp(MayanAppConfig):
func=lambda context: setting_widget(context['object'])
)
SourceColumn(
source=Setting, label=_('Value'), attribute='serialized_value'
attribute='serialized_value', label=_('Value'), source=Setting
)
SourceColumn(
source=Setting, label=_('Overrided by environment variable?'),
func=lambda context: _('Yes') if context['object'].environment_variable else _('No')
attribute='is_overrided', source=Setting, widget=TwoStateWidget
)
menu_object.bind_links(

View File

@@ -16,6 +16,7 @@ from django.utils.functional import Promise
from django.utils.encoding import (
force_bytes, force_text, python_2_unicode_compatible
)
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.serialization import yaml_dump, yaml_load
@@ -343,6 +344,12 @@ class Setting(object):
def invalidate_cache(self):
self.loaded = False
def is_overrided(self):
return self.environment_variable
is_overrided.short_description = _('Overrided')
is_overrided.help_text = 'Is this settings being overrided by an environment variable?'
def migrate(self):
self.namespace.migrate(setting=self)