fisk/core/views/risk.py

38 lines
919 B
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from mixins.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
from core.forms import RiskModelForm
from core.models import RiskModel
from core.util import logs
log = logs.get_logger(__name__)
class RiskList(LoginRequiredMixin, ObjectList):
list_template = "partials/risk-list.html"
model = RiskModel
page_title = "List of risk management strategies, linked to accounts"
list_url_name = "risks"
list_url_args = ["type"]
submit_url_name = "risk_create"
class RiskCreate(LoginRequiredMixin, ObjectCreate):
model = RiskModel
form_class = RiskModelForm
submit_url_name = "risk_create"
class RiskUpdate(LoginRequiredMixin, ObjectUpdate):
model = RiskModel
form_class = RiskModelForm
submit_url_name = "risk_update"
class RiskDelete(LoginRequiredMixin, ObjectDelete):
model = RiskModel