2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Refactor: BaseInvenTreeSetting (#4834)

* Added typing for settings

* Refactored common.BaseInvenTreeSetting model to make it more generic

* Use older syntax for union types

* Added protected option to typing

* Remove now unused code

* Remove old 'get_kwargs' method as it is replaced by 'get_filters_for_instance'

* Trigger ci
This commit is contained in:
Lukas
2023-05-19 01:51:30 +02:00
committed by GitHub
parent 61481b4eb0
commit cb8ae10280
5 changed files with 93 additions and 107 deletions

View File

@ -19,6 +19,7 @@ from common.settings import currency_code_default
from InvenTree import settings, version
from plugin import registry
from plugin.models import NotificationUserSetting, PluginSetting
from plugin.plugin import InvenTreePlugin
register = template.Library()
@ -325,6 +326,8 @@ def setting_object(key, *args, **kwargs):
# Note, 'plugin' is an instance of an InvenTreePlugin class
plugin = kwargs['plugin']
if issubclass(plugin.__class__, InvenTreePlugin):
plugin = plugin.plugin_config()
return PluginSetting.get_setting_object(key, plugin=plugin, cache=cache)