Fix CRUD for accounts and trades
This commit is contained in:
parent
2bafdf0910
commit
e2a697dcc1
|
@ -1,8 +1,8 @@
|
||||||
# Generated by Django 4.1.2 on 2022-10-17 17:18
|
# Generated by Django 4.1.2 on 2022-10-17 17:18
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 4.1.2 on 2022-10-17 17:39
|
# Generated by Django 4.1.2 on 2022-10-17 17:39
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button
|
<button
|
||||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
hx-get="{% url 'account_action' type=type %}"
|
hx-get="{% url 'account_action' type=type %}"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
hx-target="#modals-here"
|
hx-target="#modals-here"
|
||||||
class="button is-info">
|
class="button is-info">
|
||||||
<span class="icon-text">
|
<span class="icon-text">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fa-solid fa-plus"></i>
|
<i class="fa-solid fa-plus"></i>
|
||||||
</span>
|
|
||||||
<span>Account</span>
|
|
||||||
</span>
|
</span>
|
||||||
</button>
|
<span>Account</span>
|
||||||
</div>
|
</span>
|
||||||
|
</button>
|
||||||
{% include 'partials/notify.html' %}
|
</div>
|
||||||
{% include 'partials/account-list.html' %}
|
|
||||||
|
{% include 'partials/notify.html' %}
|
||||||
|
{% include 'partials/account-list.html' %}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button
|
<button
|
||||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
hx-get="{% url 'trade_action' type=type %}"
|
hx-get="{% url 'trade_action' type=type %}"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
hx-target="#modals-here"
|
hx-target="#modals-here"
|
||||||
class="button is-info">
|
class="button is-info">
|
||||||
<span class="icon-text">
|
<span class="icon-text">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fa-solid fa-plus"></i>
|
<i class="fa-solid fa-plus"></i>
|
||||||
</span>
|
|
||||||
<span>Trade</span>
|
|
||||||
</span>
|
</span>
|
||||||
</button>
|
<span>Trade</span>
|
||||||
</div>
|
</span>
|
||||||
|
</button>
|
||||||
{% include 'partials/notify.html' %}
|
</div>
|
||||||
{% include 'partials/trade-list.html' %}
|
|
||||||
|
{% include 'partials/notify.html' %}
|
||||||
|
{% include 'partials/trade-list.html' %}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from serde import ValidationError
|
||||||
|
|
||||||
from core.forms import AccountForm
|
from core.forms import AccountForm
|
||||||
from core.lib.serde import drakdoo
|
from core.lib.serde import drakdoo
|
||||||
from core.models import Callback, Account
|
from core.models import Account, Callback
|
||||||
from core.util import logs
|
from core.util import logs
|
||||||
|
|
||||||
log = logs.get_logger(__name__)
|
log = logs.get_logger(__name__)
|
||||||
|
@ -97,7 +97,9 @@ class AccountAction(LoginRequiredMixin, APIView):
|
||||||
|
|
||||||
if account_id:
|
if account_id:
|
||||||
try:
|
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:
|
except account.DoesNotExist:
|
||||||
message = "Account does not exist"
|
message = "Account does not exist"
|
||||||
message_class = "danger"
|
message_class = "danger"
|
||||||
|
|
|
@ -11,7 +11,7 @@ from serde import ValidationError
|
||||||
|
|
||||||
from core.forms import TradeForm
|
from core.forms import TradeForm
|
||||||
from core.lib.serde import drakdoo
|
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
|
from core.util import logs
|
||||||
|
|
||||||
log = logs.get_logger(__name__)
|
log = logs.get_logger(__name__)
|
||||||
|
|
Loading…
Reference in New Issue