mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Enable backup value option for plugin settings check (#6950)
This commit is contained in:
parent
b68a1cc1b8
commit
2ea82e13a5
@ -62,16 +62,19 @@ class SettingsMixin:
|
|||||||
"""Does this plugin use custom global settings."""
|
"""Does this plugin use custom global settings."""
|
||||||
return bool(self.settings)
|
return bool(self.settings)
|
||||||
|
|
||||||
def get_setting(self, key, cache=False):
|
def get_setting(self, key, cache=False, backup_value=None):
|
||||||
"""Return the 'value' of the setting associated with this plugin.
|
"""Return the 'value' of the setting associated with this plugin.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
key: The 'name' of the setting value to be retrieved
|
key: The 'name' of the setting value to be retrieved
|
||||||
cache: Whether to use RAM cached value (default = False)
|
cache: Whether to use RAM cached value (default = False)
|
||||||
|
backup_value: A backup value to return if the setting is not found
|
||||||
"""
|
"""
|
||||||
from plugin.models import PluginSetting
|
from plugin.models import PluginSetting
|
||||||
|
|
||||||
return PluginSetting.get_setting(key, plugin=self.plugin_config(), cache=cache)
|
return PluginSetting.get_setting(
|
||||||
|
key, plugin=self.plugin_config(), cache=cache, backup_value=backup_value
|
||||||
|
)
|
||||||
|
|
||||||
def set_setting(self, key, value, user=None):
|
def set_setting(self, key, value, user=None):
|
||||||
"""Set plugin setting value by key."""
|
"""Set plugin setting value by key."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user