Allow disabling accounts

This commit is contained in:
2023-01-01 15:46:40 +00:00
parent a18c150fe2
commit b31a2d1464
6 changed files with 40 additions and 3 deletions

View File

@@ -53,7 +53,8 @@ class Positions(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
if account_id:
self.extra_context["account_id"] = account_id
items = []
accounts = Account.objects.filter(user=self.request.user)
# Only get enabled accounts for positions
accounts = Account.objects.filter(user=self.request.user, enabled=True)
for account in accounts:
try:
positions = account.client.get_all_positions()

View File

@@ -22,7 +22,8 @@ class Profit(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
def get_queryset(self, **kwargs):
items = []
accounts = Account.objects.filter(user=self.request.user)
# Only get enabled accounts
accounts = Account.objects.filter(user=self.request.user, enabled=True)
for account in accounts:
try:
details = account.client.get_account()