diff --git a/core/helpers/mail.py b/core/helpers/mail.py index 7f0d978..a72a54d 100644 --- a/core/helpers/mail.py +++ b/core/helpers/mail.py @@ -1,5 +1,3 @@ -from django.conf import settings - from core.exceptions.mail import NoSuchTemplate from dbsettings.functions import getValue diff --git a/core/modules/urls.py b/core/modules/urls.py index c2cc9cb..93c971f 100644 --- a/core/modules/urls.py +++ b/core/modules/urls.py @@ -11,9 +11,9 @@ for module in settings.EXPEPHALON_MODULES: mou = importlib.import_module(f"{module}.urls") if "ADMIN_URLS" in mou.__dict__.keys(): for url, action, name in mou.ADMIN_URLS: - URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"{module}_{name}")) + URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"module_{module}_{name}")) if "API_URLS" in mou.__dict__.keys(): for url, action, name in mou.API_URLS: - URLPATTERNS.append(path(f"api/modules/{module}/{url}", action, name=f"api_{module}_{name}")) + URLPATTERNS.append(path(f"api/modules/{module}/{url}", action, name=f"api_module_{module}_{name}")) except ModuleNotFoundError: pass diff --git a/core/navigation.py b/core/navigation.py index a1b8d0a..438a304 100644 --- a/core/navigation.py +++ b/core/navigation.py @@ -1,8 +1,6 @@ from core.modules.navigation import navigations from core.classes.navigation import NavSection, NavItem -from django.conf import settings - # Dashboard Section dashboard_section = NavSection("Dashboard") diff --git a/core/views/backend/currencies.py b/core/views/backend/currencies.py index 318b340..5a2ebd0 100644 --- a/core/views/backend/currencies.py +++ b/core/views/backend/currencies.py @@ -7,10 +7,11 @@ from core.views.backend.generic import BackendListView, BackendUpdateView, Backe class CurrencyListView(BackendListView): template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/index.html" model = Currency + title = "Currency Settings" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context["title"] = "Currency Settings" + context["base_currency"] = Currency.get_base() return context class CurrencyEditView(BackendUpdateView): @@ -18,29 +19,17 @@ class CurrencyEditView(BackendUpdateView): model = Currency success_url = reverse_lazy("currencies") fields = ["name", "code", "symbol", "base", "rate"] - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context["title"] = "Edit Currency" - return context + title = "Edit Currency" class CurrencyDeleteView(BackendDeleteView): template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/delete.html" model = Currency success_url = reverse_lazy("currencies") - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context["title"] = "Delete Currency" - return context + title = "Delete Currency" class CurrencyCreateView(BackendCreateView): template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/create.html" model = Currency success_url = reverse_lazy("currencies") fields = ["name", "code", "symbol", "base", "rate"] - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context["title"] = "Create Currency" - return context + title = "Create Currency" diff --git a/core/views/backend/generic.py b/core/views/backend/generic.py index 9104b06..4f9d279 100644 --- a/core/views/backend/generic.py +++ b/core/views/backend/generic.py @@ -1,6 +1,7 @@ from django.views.generic import TemplateView, ListView, CreateView, FormView, DeleteView, UpdateView from core.mixins.auth import AdminMixin +from core.views.generic import RedirectView class BackendViewMixin(AdminMixin): def get_context_data(self, **kwargs): @@ -27,4 +28,7 @@ class BackendDeleteView(BackendViewMixin, DeleteView): pass class BackendUpdateView(BackendViewMixin, UpdateView): + pass + +class BackendRedirectView(AdminMixin, RedirectView): pass \ No newline at end of file diff --git a/core/views/generic.py b/core/views/generic.py new file mode 100644 index 0000000..824e1c7 --- /dev/null +++ b/core/views/generic.py @@ -0,0 +1,9 @@ +from django.views import View +from django.shortcuts import redirect + +class RedirectView(View): + def dispatch(self, request, *args, **kwargs): + try: + return redirect(request.GET.get("next")) + except: + return redirect(self.next) \ No newline at end of file diff --git a/kumisms b/kumisms index 0aa67e6..8ee4066 160000 --- a/kumisms +++ b/kumisms @@ -1 +1 @@ -Subproject commit 0aa67e65c1a0eede3016e727e587ca21fb5b4bc9 +Subproject commit 8ee4066973d81d3556b021e0b892ae325fc89b48 diff --git a/templates/backend/currencies/index.html b/templates/backend/currencies/index.html index cf572eb..276efe0 100644 --- a/templates/backend/currencies/index.html +++ b/templates/backend/currencies/index.html @@ -39,15 +39,17 @@