Implement profit view and fix auto refresh

This commit is contained in:
2022-11-29 07:20:39 +00:00
parent 2b13802009
commit a39a5c3857
10 changed files with 192 additions and 84 deletions

View File

@@ -61,6 +61,8 @@ class Positions(LoginRequiredMixin, OTPRequiredMixin, View):
list_template = "partials/position-list.html"
page_title = "Live positions from all exchanges"
page_subtitle = "Manual trades are editable under 'Bot Trades' tab."
context_object_name_singular = "position"
context_object_name = "positions"
def get(self, request, type, account_id=None):
if type not in self.allowed_types:
@@ -89,12 +91,14 @@ class Positions(LoginRequiredMixin, OTPRequiredMixin, View):
"page_title": self.page_title,
"page_subtitle": self.page_subtitle,
"list_url": list_url,
"context_object_name_singular": "position",
"context_object_name": "positions",
"context_object_name_singular": self.context_object_name_singular,
"context_object_name": self.context_object_name,
}
# Return partials for HTMX
if self.request.htmx:
if orig_type == "page":
if request.headers["HX-Target"] == self.context_object_name + "-table":
self.template_name = self.list_template
elif orig_type == "page":
self.template_name = self.list_template
else:
context["window_content"] = self.list_template