fisk/core/views/limits.py

48 lines
1.2 KiB
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from core.forms import TradingTimeForm
from core.models import TradingTime
from core.util import logs
from core.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
log = logs.get_logger(__name__)
class TradingTimeList(LoginRequiredMixin, ObjectList):
list_template = "partials/trading-time-list.html"
model = TradingTime
page_title = "List of allowed trading times. Used as options for a strategy."
page_subtitle = "Add times here in order to permit trading."
list_url_name = "tradingtimes"
list_url_args = ["type"]
submit_url_name = "tradingtime_create"
class TradingTimeCreate(LoginRequiredMixin, ObjectCreate):
model = TradingTime
form_class = TradingTimeForm
list_url_name = "tradingtimes"
list_url_args = ["type"]
submit_url_name = "tradingtime_create"
class TradingTimeUpdate(LoginRequiredMixin, ObjectUpdate):
model = TradingTime
form_class = TradingTimeForm
list_url_name = "tradingtimes"
list_url_args = ["type"]
submit_url_name = "tradingtime_update"
class TradingTimeDelete(LoginRequiredMixin, ObjectDelete):
model = TradingTime
list_url_name = "tradingtimes"
list_url_args = ["type"]