fisk/core/views/risk.py

38 lines
918 B
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from core.forms import RiskModelForm
from core.models import RiskModel
from core.util import logs
from core.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
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