expephalon-smsotp/core/navigation.py
Klaus-Uwe Mitterer a133ea4cb1 A lot of changes:
Prepare for Minio/S3 media storage
Add current FontAwesome
Move statics and templates out of core
Add navigation menu generation
Add name attribute to URLs
Probably many other things I forgot by now
2020-04-07 21:52:10 +02:00

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