Simplify DB object management with Django CRUD helpers

This commit is contained in:
2022-10-29 12:43:13 +01:00
parent 8f705e2f25
commit c685b6d25f
26 changed files with 435 additions and 936 deletions

View File

@@ -37,7 +37,10 @@ def get_positions(user, account_id=None):
class Positions(LoginRequiredMixin, View):
allowed_types = ["modal", "widget", "window", "page"]
window_content = "window-content/positions.html"
window_content = "window-content/objects.html"
list_template = "partials/position-list.html"
page_title = "Live positions from all exchanges"
page_subtitle = "Manual trades are editable under 'Bot Trades' tab."
async def get(self, request, type, account_id=None):
if type not in self.allowed_types:
@@ -51,8 +54,11 @@ class Positions(LoginRequiredMixin, View):
"title": f"Hooks ({type})",
"unique": unique,
"window_content": self.window_content,
"list_template": self.list_template,
"items": items,
"type": type,
"page_title": self.page_title,
"page_subtitle": self.page_subtitle,
}
return render(request, template_name, context)