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