expephalon/core/modules/navigation.py
2020-06-01 18:29:22 +02:00

20 lines
No EOL
596 B
Python

import importlib
from django.conf import settings
from core.classes.navigation import Navigation
navigations = {
"backend_main": Navigation(),
"frontend_main": Navigation(),
}
for module in ["core"] + settings.EXPEPHALON_MODULES:
try:
mon = importlib.import_module(f"{module}.navigation")
for name, nav in mon.NAVIGATIONS:
if name in navigations.keys:
raise ValueError(f"Error in {module}: Navigation of name {name} already exists!")
navigations[name] = nav
except (AttributeError, ModuleNotFoundError):
continue