diff --git a/InvenTree/plugin/base/integration/mixins.py b/InvenTree/plugin/base/integration/mixins.py index f8280e9bd8..b9e4b34393 100644 --- a/InvenTree/plugin/base/integration/mixins.py +++ b/InvenTree/plugin/base/integration/mixins.py @@ -8,10 +8,8 @@ from django.urls import include, re_path import requests -import InvenTree.helpers from plugin.helpers import (MixinImplementationError, MixinNotImplementedError, render_template, render_text) -from plugin.models import PluginConfig, PluginSetting from plugin.urls import PLUGIN_BASE logger = logging.getLogger('inventree') @@ -42,10 +40,14 @@ class SettingsMixin: key: The 'name' of the setting value to be retrieved cache: Whether to use RAM cached value (default = False) """ + from plugin.models import PluginSetting + return PluginSetting.get_setting(key, plugin=self, cache=cache) def set_setting(self, key, value, user=None): """Set plugin setting value by key.""" + from plugin.models import PluginConfig, PluginSetting + try: plugin, _ = PluginConfig.objects.get_or_create(key=self.plugin_slug(), name=self.plugin_name()) except (OperationalError, ProgrammingError): # pragma: no cover @@ -698,6 +700,8 @@ class PanelMixin: Returns: Array of panels """ + import InvenTree.helpers + panels = [] # Construct an updated context object for template rendering diff --git a/InvenTree/plugin/registry.py b/InvenTree/plugin/registry.py index 7ca4d99d9c..fac0d33194 100644 --- a/InvenTree/plugin/registry.py +++ b/InvenTree/plugin/registry.py @@ -36,8 +36,9 @@ logger = logging.getLogger('inventree') class PluginsRegistry: """The PluginsRegistry class.""" - from . import mixins - DEFAULT_MIXIN_ORDER = [mixins.SettingsMixin, mixins.ScheduleMixin, mixins.AppMixin, mixins.UrlsMixin] + from .base.integration.mixins import (AppMixin, ScheduleMixin, + SettingsMixin, UrlsMixin) + DEFAULT_MIXIN_ORDER = [SettingsMixin, ScheduleMixin, AppMixin, UrlsMixin] def __init__(self, mixin_order: list = None) -> None: """Initialize registry.