expephalon/core/views/backend/currencies.py
Klaus-Uwe Mitterer fb02819e36 Improved currency display
Implemented RedirectViews
Changed URL scheme for submodules
Updated kumisms and ratesapi submodules
2020-06-10 13:43:14 +02:00

35 lines
1.3 KiB
Python

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"