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 title = "Currency Settings" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["base_currency"] = Currency.get_base() 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"] title = "Edit Currency" class CurrencyDeleteView(BackendDeleteView): template_name = f"{settings.EXPEPHALON_BACKEND}/currencies/delete.html" model = Currency success_url = reverse_lazy("currencies") 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"] title = "Create Currency"