expephalon-demomodule/core/modules/navigation.py

20 lines
617 B
Python
Raw Normal View History

import importlib
from django.conf import settings
from core.classes.navigation import NavItem, NavSection, 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