2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00
This commit is contained in:
Matthias
2021-10-17 04:47:10 +02:00
parent 48abd3cf79
commit 279ed78119
6 changed files with 11 additions and 8 deletions

View File

@ -12,13 +12,16 @@ class PluginConfig(AppConfig):
def ready(self):
from common.models import InvenTreeSetting
plugins = settings.INTEGRATION_PLUGINS.items()
# if plugin settings are enabled enhance the settings
if InvenTreeSetting.get_setting('ENABLE_PLUGINS_SETTING'):
for slug, plugin in settings.INTEGRATION_PLUGIN_LIST.items():
for slug, plugin in plugins:
if plugin.mixin_enabled('settings'):
plugin_setting = plugin.settingspatterns
settings.INTEGRATION_PLUGIN_SETTING[slug] = plugin_setting
# Add to settings dir
InvenTreeSetting.GLOBAL_SETTINGS.update(plugin_setting)
# if plugin apps are enabled
@ -27,7 +30,7 @@ class PluginConfig(AppConfig):
apps_changed = False
# add them to the INSTALLED_APPS
for slug, plugin in settings.INTEGRATION_PLUGIN_LIST.items():
for slug, plugin in plugins:
if plugin.mixin_enabled('app'):
plugin_path = '.'.join(pathlib.Path(plugin.path).relative_to(settings.BASE_DIR).parts)
settings.INSTALLED_APPS += [plugin_path]

View File

@ -12,7 +12,7 @@ class PluginTemplateLoader(FilesystemLoader):
def get_dirs(self):
dirname = 'templates'
template_dirs = []
for plugin in settings.INTEGRATION_PLUGIN_LIST.values():
for plugin in settings.INTEGRATION_PLUGINS.values():
new_path = Path(plugin.path) / dirname
if Path(new_path).is_dir():
template_dirs.append(new_path)

View File

@ -57,7 +57,7 @@ class PluginTagTests(TestCase):
def test_tag_plugin_list(self):
"""test that all plugins are listed"""
self.assertEqual(plugin_tags.plugin_list(), settings.INTEGRATION_PLUGIN_LIST)
self.assertEqual(plugin_tags.plugin_list(), settings.INTEGRATION_PLUGINS)
def test_tag_plugin_settings(self):
"""check all plugins are listed"""