Wrap API calls in helper and validate response

This commit is contained in:
2022-10-30 19:11:07 +00:00
parent f22fcfdaaa
commit c15ae379f5
15 changed files with 224 additions and 163 deletions

View File

@@ -39,7 +39,15 @@ class AccountInfo(LoginRequiredMixin, View):
}
return render(request, template_name, context)
live_info = dict(account.client.get_account())
success, live_info = account.client.get_account()
if not success:
context = {
"message": "Could not get account info",
"class": "danger",
"window_content": self.window_content,
}
return render(request, template_name, context)
live_info = live_info
account_info = account.__dict__
account_info = {
k: v for k, v in account_info.items() if k in self.VIEWABLE_FIELDS_MODEL