expephalon-demomodule/core/modules/urls.py
Klaus-Uwe Mitterer 7708128255 Finally got all the OTP stuff working
Finalized dbsettings views
Easter egg for missing backend pages
2020-04-15 22:19:03 +02:00

32 lines
No EOL
1.5 KiB
Python

import importlib
from django.conf import settings
from django.urls import path
from core.views import DashboardView, LoginView, OTPSelectorView, LogoutView, OTPValidatorView, BackendNotImplementedView
URLPATTERNS = [
path('login/', LoginView.as_view(), name="login"),
path('login/otp/select/', OTPSelectorView.as_view(), name="otpselector"),
path('login/otp/validate/', OTPValidatorView.as_view(), name="otpvalidator"),
path('logout/', LogoutView.as_view(), name="logout"),
path('admin/', DashboardView.as_view(), name="dashboard"),
path('admin/oops/', BackendNotImplementedView.as_view(), name="backendni")
]
for module in settings.EXPEPHALON_MODULES:
try:
mou = importlib.import_module(f"{module}.urls")
for url, action, name in mou.ADMIN_URLS:
URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"{module}_{name}"))
except (AttributeError, ModuleNotFoundError):
pass
try:
from core.views import DBSettingsListView, DBSettingsEditView, DBSettingsDeleteView, DBSettingsCreateView
URLPATTERNS.append(path("admin/dbsettings/", DBSettingsListView.as_view(), name="dbsettings"))
URLPATTERNS.append(path("admin/dbsettings/<pk>/delete/", DBSettingsDeleteView.as_view(), name="dbsettings_delete"))
URLPATTERNS.append(path("admin/dbsettings/<pk>/edit/", DBSettingsEditView.as_view(), name="dbsettings_edit"))
URLPATTERNS.append(path("admin/dbsettings/create/", DBSettingsCreateView.as_view(), name="dbsettings_create"))
except:
pass