mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
rename / cleanup
This commit is contained in:
parent
2f306d951f
commit
b05381fcc8
@ -18,7 +18,7 @@ from part.urls import part_urls
|
|||||||
from stock.urls import stock_urls
|
from stock.urls import stock_urls
|
||||||
from build.urls import build_urls
|
from build.urls import build_urls
|
||||||
from order.urls import order_urls
|
from order.urls import order_urls
|
||||||
from plugin.urls import plugin_urls, get_integration_urls
|
from plugin.urls import get_plugin_urls
|
||||||
|
|
||||||
from barcodes.api import barcode_api_urls
|
from barcodes.api import barcode_api_urls
|
||||||
from common.api import common_api_urls
|
from common.api import common_api_urls
|
||||||
@ -159,8 +159,7 @@ urlpatterns = [
|
|||||||
url(r'^api-doc/', include_docs_urls(title='InvenTree API')),
|
url(r'^api-doc/', include_docs_urls(title='InvenTree API')),
|
||||||
|
|
||||||
# plugin urls
|
# plugin urls
|
||||||
url(r'^plugins/', include(plugin_urls)),
|
get_plugin_urls(), # appends currently loaded plugin urls = None
|
||||||
get_integration_urls(), # appends currently loaded plugin urls = None
|
|
||||||
|
|
||||||
url(r'^markdownx/', include('markdownx.urls')),
|
url(r'^markdownx/', include('markdownx.urls')),
|
||||||
|
|
||||||
|
@ -385,14 +385,14 @@ class PluginAppConfig(AppConfig):
|
|||||||
|
|
||||||
def _update_urls(self):
|
def _update_urls(self):
|
||||||
from InvenTree.urls import urlpatterns
|
from InvenTree.urls import urlpatterns
|
||||||
from plugin.urls import get_integration_urls
|
from plugin.urls import get_plugin_urls
|
||||||
|
|
||||||
for index, a in enumerate(urlpatterns):
|
for index, a in enumerate(urlpatterns):
|
||||||
if hasattr(a, 'app_name'):
|
if hasattr(a, 'app_name'):
|
||||||
if a.app_name == 'admin':
|
if a.app_name == 'admin':
|
||||||
urlpatterns[index] = url(r'^admin/', admin.site.urls, name='inventree-admin')
|
urlpatterns[index] = url(r'^admin/', admin.site.urls, name='inventree-admin')
|
||||||
elif a.app_name == 'plugin':
|
elif a.app_name == 'plugin':
|
||||||
urlpatterns[index] = get_integration_urls()
|
urlpatterns[index] = get_plugin_urls()
|
||||||
clear_url_caches()
|
clear_url_caches()
|
||||||
|
|
||||||
def _reload_apps(self, force_reload: bool = False):
|
def _reload_apps(self, force_reload: bool = False):
|
||||||
|
@ -8,14 +8,10 @@ from django.conf.urls import url, include
|
|||||||
PLUGIN_BASE = 'plugin' # Constant for links
|
PLUGIN_BASE = 'plugin' # Constant for links
|
||||||
|
|
||||||
|
|
||||||
def get_integration_urls():
|
def get_plugin_urls():
|
||||||
"""returns a urlpattern that can be integrated into the global urls"""
|
"""returns a urlpattern that can be integrated into the global urls"""
|
||||||
urls = []
|
urls = []
|
||||||
for plugin in settings.INTEGRATION_PLUGINS.values():
|
for plugin in settings.INTEGRATION_PLUGINS.values():
|
||||||
if plugin.mixin_enabled('urls'):
|
if plugin.mixin_enabled('urls'):
|
||||||
urls.append(plugin.urlpatterns)
|
urls.append(plugin.urlpatterns)
|
||||||
return url(f'^{PLUGIN_BASE}/', include((urls, 'plugin')))
|
return url(f'^{PLUGIN_BASE}/', include((urls, 'plugin')))
|
||||||
|
|
||||||
|
|
||||||
plugin_urls = [
|
|
||||||
]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user