2022-10-27 17:08:40 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
|
|
|
|
from core.forms import StrategyForm
|
|
|
|
from core.models import Strategy
|
|
|
|
from core.util import logs
|
2022-10-29 11:43:13 +00:00
|
|
|
from core.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
|
2022-10-27 17:08:40 +00:00
|
|
|
|
|
|
|
# from django.urls import reverse
|
|
|
|
|
|
|
|
|
|
|
|
log = logs.get_logger(__name__)
|
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class StrategyList(LoginRequiredMixin, ObjectList):
|
|
|
|
list_template = "partials/strategy-list.html"
|
|
|
|
model = Strategy
|
|
|
|
page_title = "List of strategies"
|
2022-10-27 17:08:40 +00:00
|
|
|
|
2022-10-29 13:05:01 +00:00
|
|
|
list_url_name = "strategies"
|
|
|
|
list_url_args = ["type"]
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
submit_url_name = "strategy_create"
|
2022-10-27 17:08:40 +00:00
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class StrategyCreate(LoginRequiredMixin, ObjectCreate):
|
|
|
|
model = Strategy
|
|
|
|
form_class = StrategyForm
|
2022-10-29 13:05:01 +00:00
|
|
|
list_url_name = "strategies"
|
|
|
|
list_url_args = ["type"]
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
submit_url_name = "strategy_create"
|
2022-10-27 17:08:40 +00:00
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class StrategyUpdate(LoginRequiredMixin, ObjectUpdate):
|
|
|
|
model = Strategy
|
|
|
|
form_class = StrategyForm
|
2022-10-29 13:05:01 +00:00
|
|
|
|
|
|
|
list_url_name = "strategies"
|
|
|
|
list_url_args = ["type"]
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
submit_url_name = "strategy_update"
|
2022-10-27 17:08:40 +00:00
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class StrategyDelete(LoginRequiredMixin, ObjectDelete):
|
|
|
|
model = Strategy
|
2022-10-29 13:05:01 +00:00
|
|
|
|
|
|
|
list_url_name = "strategies"
|
|
|
|
list_url_args = ["type"]
|