from django.conf import settings from django.urls import reverse_lazy from core.models.local import Currency from core.views.backend.generic import BackendListView, BackendUpdateView, BackendDeleteView, BackendCreateView class CurrencyListView(BackendListView): template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/index.html" model = Currency def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["title"] = "Currency Settings" return context class CurrencyEditView(BackendUpdateView): template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/update.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"] = "Edit Currency" return context 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 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