2022-10-17 17:56:16 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
|
|
|
|
from core.forms import TradeForm
|
2022-10-29 11:43:13 +00:00
|
|
|
from core.models import Trade
|
2022-10-17 17:56:16 +00:00
|
|
|
from core.util import logs
|
2022-10-29 11:43:13 +00:00
|
|
|
from core.views import ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
|
2022-10-17 17:56:16 +00:00
|
|
|
|
|
|
|
log = logs.get_logger(__name__)
|
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class TradeList(LoginRequiredMixin, ObjectList):
|
|
|
|
list_template = "partials/trade-list.html"
|
|
|
|
model = Trade
|
|
|
|
context_object_name = "trades"
|
2022-10-29 13:05:01 +00:00
|
|
|
context_object_name_singular = "trade"
|
2022-10-29 11:43:13 +00:00
|
|
|
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."
|
2022-10-17 17:56:16 +00:00
|
|
|
|
2022-10-29 13:05:01 +00:00
|
|
|
list_url_name = "trades"
|
|
|
|
list_url_args = ["type"]
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
submit_url_name = "trade_create"
|
2022-10-17 17:56:16 +00:00
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class TradeCreate(LoginRequiredMixin, ObjectCreate):
|
|
|
|
model = Trade
|
|
|
|
form_class = TradeForm
|
|
|
|
context_object_name = "trades"
|
2022-10-29 13:05:01 +00:00
|
|
|
context_object_name_singular = "trade"
|
|
|
|
|
|
|
|
list_url_name = "trades"
|
|
|
|
list_url_args = ["type"]
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
submit_url_name = "trade_create"
|
2022-10-17 17:56:16 +00:00
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class TradeUpdate(LoginRequiredMixin, ObjectUpdate):
|
|
|
|
model = Trade
|
|
|
|
form_class = TradeForm
|
|
|
|
context_object_name = "trades"
|
2022-10-29 13:05:01 +00:00
|
|
|
context_object_name_singular = "trade"
|
|
|
|
|
|
|
|
list_url_name = "trades"
|
|
|
|
list_url_args = ["type"]
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
submit_url_name = "trade_update"
|
2022-10-17 17:56:16 +00:00
|
|
|
|
|
|
|
|
2022-10-29 11:43:13 +00:00
|
|
|
class TradeDelete(LoginRequiredMixin, ObjectDelete):
|
|
|
|
model = Trade
|
2022-10-29 13:05:01 +00:00
|
|
|
context_object_name = "trades"
|
|
|
|
context_object_name_singular = "trade"
|
|
|
|
|
|
|
|
list_url_name = "trades"
|
|
|
|
list_url_args = ["type"]
|