2022-12-21 21:35:59 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
2023-02-10 20:49:35 +00:00
|
|
|
from mixins.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
|
2022-12-21 21:35:59 +00:00
|
|
|
|
2022-12-13 07:20:49 +00:00
|
|
|
from core.forms import RiskModelForm
|
|
|
|
from core.models import RiskModel
|
2022-12-21 21:35:59 +00:00
|
|
|
from core.util import logs
|
|
|
|
|
|
|
|
log = logs.get_logger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class RiskList(LoginRequiredMixin, ObjectList):
|
2022-12-13 07:20:49 +00:00
|
|
|
list_template = "partials/risk-list.html"
|
|
|
|
model = RiskModel
|
2022-12-21 21:35:59 +00:00
|
|
|
page_title = "List of risk management strategies. Linked to accounts."
|
|
|
|
|
2022-12-13 07:20:49 +00:00
|
|
|
list_url_name = "risks"
|
2022-12-21 21:35:59 +00:00
|
|
|
list_url_args = ["type"]
|
|
|
|
|
|
|
|
submit_url_name = "risk_create"
|
|
|
|
|
|
|
|
|
|
|
|
class RiskCreate(LoginRequiredMixin, ObjectCreate):
|
2022-12-13 07:20:49 +00:00
|
|
|
model = RiskModel
|
|
|
|
form_class = RiskModelForm
|
2022-12-21 21:35:59 +00:00
|
|
|
|
|
|
|
submit_url_name = "risk_create"
|
|
|
|
|
|
|
|
|
|
|
|
class RiskUpdate(LoginRequiredMixin, ObjectUpdate):
|
2022-12-13 07:20:49 +00:00
|
|
|
model = RiskModel
|
|
|
|
form_class = RiskModelForm
|
2022-12-21 21:35:59 +00:00
|
|
|
|
|
|
|
submit_url_name = "risk_update"
|
|
|
|
|
|
|
|
|
|
|
|
class RiskDelete(LoginRequiredMixin, ObjectDelete):
|
2022-12-13 07:20:49 +00:00
|
|
|
model = RiskModel
|