expephalon-kumisms/core/modules/navigation.py

20 lines
No EOL
618 B
Python

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