fix import order

This commit is contained in:
Matthias Mair 2023-02-13 20:47:25 +01:00
parent 329f336b57
commit b01d54b586
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A
2 changed files with 9 additions and 4 deletions

View File

@ -8,10 +8,8 @@ from django.urls import include, re_path
import requests import requests
import InvenTree.helpers
from plugin.helpers import (MixinImplementationError, MixinNotImplementedError, from plugin.helpers import (MixinImplementationError, MixinNotImplementedError,
render_template, render_text) render_template, render_text)
from plugin.models import PluginConfig, PluginSetting
from plugin.urls import PLUGIN_BASE from plugin.urls import PLUGIN_BASE
logger = logging.getLogger('inventree') logger = logging.getLogger('inventree')
@ -42,10 +40,14 @@ class SettingsMixin:
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)
""" """
from plugin.models import PluginSetting
return PluginSetting.get_setting(key, plugin=self, cache=cache) return PluginSetting.get_setting(key, plugin=self, cache=cache)
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."""
from plugin.models import PluginConfig, PluginSetting
try: try:
plugin, _ = PluginConfig.objects.get_or_create(key=self.plugin_slug(), name=self.plugin_name()) plugin, _ = PluginConfig.objects.get_or_create(key=self.plugin_slug(), name=self.plugin_name())
except (OperationalError, ProgrammingError): # pragma: no cover except (OperationalError, ProgrammingError): # pragma: no cover
@ -698,6 +700,8 @@ class PanelMixin:
Returns: Returns:
Array of panels Array of panels
""" """
import InvenTree.helpers
panels = [] panels = []
# Construct an updated context object for template rendering # Construct an updated context object for template rendering

View File

@ -36,8 +36,9 @@ logger = logging.getLogger('inventree')
class PluginsRegistry: class PluginsRegistry:
"""The PluginsRegistry class.""" """The PluginsRegistry class."""
from . import mixins from .base.integration.mixins import (AppMixin, ScheduleMixin,
DEFAULT_MIXIN_ORDER = [mixins.SettingsMixin, mixins.ScheduleMixin, mixins.AppMixin, mixins.UrlsMixin] SettingsMixin, UrlsMixin)
DEFAULT_MIXIN_ORDER = [SettingsMixin, ScheduleMixin, AppMixin, UrlsMixin]
def __init__(self, mixin_order: list = None) -> None: def __init__(self, mixin_order: list = None) -> None:
"""Initialize registry. """Initialize registry.