fisk/core/views/strategies.py

60 lines
1.5 KiB
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from core.forms import StrategyForm
from core.models import Strategy
from core.util import logs
from core.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
# from django.urls import reverse
log = logs.get_logger(__name__)
class StrategyList(LoginRequiredMixin, ObjectList):
list_template = "partials/strategy-list.html"
model = Strategy
context_object_name = "strategies"
context_object_name_singular = "strategy"
title = "Strategies"
title_singular = "Strategy"
page_title = "List of strategies"
list_url_name = "strategies"
list_url_args = ["type"]
submit_url_name = "strategy_create"
class StrategyCreate(LoginRequiredMixin, ObjectCreate):
model = Strategy
form_class = StrategyForm
context_object_name = "strategies"
context_object_name_singular = "strategy"
list_url_name = "strategies"
list_url_args = ["type"]
submit_url_name = "strategy_create"
class StrategyUpdate(LoginRequiredMixin, ObjectUpdate):
model = Strategy
form_class = StrategyForm
context_object_name = "strategies"
context_object_name_singular = "strategy"
list_url_name = "strategies"
list_url_args = ["type"]
submit_url_name = "strategy_update"
class StrategyDelete(LoginRequiredMixin, ObjectDelete):
model = Strategy
context_object_name = "strategies"
context_object_name_singular = "strategy"
list_url_name = "strategies"
list_url_args = ["type"]