You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from core.forms import TradeForm
from core.models import Trade
from core.util import logs
from core.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
log = logs.get_logger(__name__)
class TradeList(LoginRequiredMixin, ObjectList):
list_template = "partials/trade-list.html"
model = Trade
context_object_name = "trades"
context_object_name_singular = "trade"
title = "Trades"
title_singular = "Trade"
page_title = (
"List of bot and manual trades. This may not reflect actual live trades."
)
page_subtitle = "Trades deleted here will not be closed on the exchange."
list_url_name = "trades"
list_url_args = ["type"]
submit_url_name = "trade_create"
class TradeCreate(LoginRequiredMixin, ObjectCreate):
model = Trade
form_class = TradeForm
context_object_name = "trades"
context_object_name_singular = "trade"
list_url_name = "trades"
list_url_args = ["type"]
submit_url_name = "trade_create"
class TradeUpdate(LoginRequiredMixin, ObjectUpdate):
model = Trade
form_class = TradeForm
context_object_name = "trades"
context_object_name_singular = "trade"
list_url_name = "trades"
list_url_args = ["type"]
submit_url_name = "trade_update"
class TradeDelete(LoginRequiredMixin, ObjectDelete):
model = Trade
context_object_name = "trades"
context_object_name_singular = "trade"
list_url_name = "trades"
list_url_args = ["type"]