expephalon/core/modules/urls.py

20 lines
683 B
Python
Raw Normal View History

import importlib
from django.conf import settings
from django.urls import path
URLPATTERNS = []
2020-06-03 16:23:00 +00:00
APIPATTERNS = []
for module in settings.EXPEPHALON_MODULES:
try:
mou = importlib.import_module(f"{module}.urls")
2020-06-03 16:23:00 +00:00
if "ADMIN_URLS" in mou.__dict__.keys():
for url, action, name in mou.ADMIN_URLS:
URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"{module}_{name}"))
if "API_URLS" in mou.__dict__.keys():
for url, action, name in mou.API_URLS:
URLPATTERNS.append(path(f"api/modules/{module}/{url}", action, name=f"api_{module}_{name}"))
except ModuleNotFoundError:
pass