expephalon-smsotp/core/modules/navigation.py

20 lines
618 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}.navigations")
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