From e2a697dcc1f54281c95315c7670678dc8cb32771 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 17 Oct 2022 19:06:09 +0100 Subject: [PATCH] Fix CRUD for accounts and trades --- core/migrations/0007_account.py | 2 +- core/migrations/0008_trade.py | 2 +- core/templates/window-content/accounts.html | 35 ++++++++++----------- core/templates/window-content/trades.html | 35 ++++++++++----------- core/views/accounts.py | 6 ++-- core/views/trades.py | 2 +- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/core/migrations/0007_account.py b/core/migrations/0007_account.py index f35cf47..7f25c26 100644 --- a/core/migrations/0007_account.py +++ b/core/migrations/0007_account.py @@ -1,8 +1,8 @@ # Generated by Django 4.1.2 on 2022-10-17 17:18 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/core/migrations/0008_trade.py b/core/migrations/0008_trade.py index b758e95..587b29a 100644 --- a/core/migrations/0008_trade.py +++ b/core/migrations/0008_trade.py @@ -1,7 +1,7 @@ # Generated by Django 4.1.2 on 2022-10-17 17:39 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/core/templates/window-content/accounts.html b/core/templates/window-content/accounts.html index cff0e65..928ed71 100644 --- a/core/templates/window-content/accounts.html +++ b/core/templates/window-content/accounts.html @@ -1,20 +1,19 @@
- -
- - {% include 'partials/notify.html' %} - {% include 'partials/account-list.html' %} - - \ No newline at end of file + Account + + + + +{% include 'partials/notify.html' %} +{% include 'partials/account-list.html' %} + diff --git a/core/templates/window-content/trades.html b/core/templates/window-content/trades.html index c6f6574..97de959 100644 --- a/core/templates/window-content/trades.html +++ b/core/templates/window-content/trades.html @@ -1,20 +1,19 @@
- -
- - {% include 'partials/notify.html' %} - {% include 'partials/trade-list.html' %} - - \ No newline at end of file + Trade + + + + +{% include 'partials/notify.html' %} +{% include 'partials/trade-list.html' %} + diff --git a/core/views/accounts.py b/core/views/accounts.py index b66f7cc..9266006 100644 --- a/core/views/accounts.py +++ b/core/views/accounts.py @@ -11,7 +11,7 @@ from serde import ValidationError from core.forms import AccountForm from core.lib.serde import drakdoo -from core.models import Callback, Account +from core.models import Account, Callback from core.util import logs log = logs.get_logger(__name__) @@ -97,7 +97,9 @@ class AccountAction(LoginRequiredMixin, APIView): if account_id: try: - form = AccountForm(request.data, instance=account.objects.get(id=account_id)) + form = AccountForm( + request.data, instance=account.objects.get(id=account_id) + ) except account.DoesNotExist: message = "Account does not exist" message_class = "danger" diff --git a/core/views/trades.py b/core/views/trades.py index ed865d7..2d98827 100644 --- a/core/views/trades.py +++ b/core/views/trades.py @@ -11,7 +11,7 @@ from serde import ValidationError from core.forms import TradeForm from core.lib.serde import drakdoo -from core.models import Callback, Trade, Account +from core.models import Account, Callback, Trade from core.util import logs log = logs.get_logger(__name__)