mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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."""
|
||||
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.
|
||||
|
||||
Arguments:
|
||||
key: The 'name' of the setting value to be retrieved
|
||||
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
|
||||
|
||||
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):
|
||||
"""Set plugin setting value by key."""
|
||||
|
Loading…
Reference in New Issue
Block a user