add url setting

This commit is contained in:
Matthias 2021-10-16 00:34:15 +02:00
parent 41ce66df6e
commit 952e7e4554
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
3 changed files with 13 additions and 5 deletions

View File

@ -43,6 +43,7 @@ from .views import AppearanceSelectView, SettingCategorySelectView
from .views import DynamicJsView
from common.views import SettingEdit, UserSettingEdit
from common.models import InvenTreeSetting
from .api import InfoView, NotFoundView
from .api import ActionPluginView
@ -125,8 +126,9 @@ translated_javascript_urls = [
]
# Integration plugin urls
integration_plugins = settings.INTEGRATION_PLUGINS
interation_urls = []
if InvenTreeSetting.get_setting('ENABLE_PLUGINS_URL'):
integration_plugins = settings.INTEGRATION_PLUGINS
for plugin in integration_plugins:
if plugin.mixin_enabled('urls'):
interation_urls.append(plugin.urlpatterns)

View File

@ -854,7 +854,12 @@ class InvenTreeSetting(BaseInvenTreeSetting):
'default': '',
'choices': settings_group_options
},
'ENABLE_PLUGINS_URL': {
'name': _('Enable URL integration'),
'description': _('Enable plugins to add URL routes'),
'default': False,
'validator': bool,
},
'ENABLE_PLUGINS_NAVIGATION': {
'name': _('Enable navigation integration'),
'description': _('Enable plugins to integrate into navigation'),

View File

@ -16,6 +16,7 @@
<table class='table table-striped table-condensed'>
{% include "InvenTree/settings/header.html" %}
<tbody>
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_URL" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_NAVIGATION" %}
</tbody>
</table>