Allow deleting requisitions
This commit is contained in:
parent
8f92c7c840
commit
e934e7b1a2
@ -126,6 +126,11 @@ urlpatterns = [
|
|||||||
banks.BanksRequisitionUpdate.as_view(),
|
banks.BanksRequisitionUpdate.as_view(),
|
||||||
name="requisition_update",
|
name="requisition_update",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"banks/<str:type>/req_delete/<str:pk>/",
|
||||||
|
banks.BanksRequisitionDelete.as_view(),
|
||||||
|
name="requisition_delete",
|
||||||
|
),
|
||||||
# Bank balances
|
# Bank balances
|
||||||
path(
|
path(
|
||||||
"banks/<str:type>/balances/",
|
"banks/<str:type>/balances/",
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<th>aggregator</th>
|
<th>aggregator</th>
|
||||||
<th>payees</th>
|
<th>payees</th>
|
||||||
<th>throughput</th>
|
<th>throughput</th>
|
||||||
|
<th>actions</th>
|
||||||
</thead>
|
</thead>
|
||||||
{% for item in requisitions %}
|
{% for item in requisitions %}
|
||||||
<tr>
|
<tr>
|
||||||
@ -25,6 +26,22 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.throughput }}</td>
|
<td>{{ item.throughput }}</td>
|
||||||
|
<td>
|
||||||
|
<button
|
||||||
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
|
hx-delete="{% url 'requisition_delete' type=type pk=item.id %}"
|
||||||
|
hx-trigger="click"
|
||||||
|
hx-target="#modals-here"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-confirm="Are you sure you wish to delete requisition {{ item.id }}?"
|
||||||
|
class="button">
|
||||||
|
<span class="icon-text">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fa-solid fa-xmark"></i>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from mixins.views import ObjectList, ObjectUpdate
|
from mixins.views import ObjectDelete, ObjectList, ObjectUpdate
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from two_factor.views.mixins import OTPRequiredMixin
|
from two_factor.views.mixins import OTPRequiredMixin
|
||||||
|
|
||||||
@ -45,6 +45,10 @@ class BanksRequisitionUpdate(LoginRequiredMixin, OTPRequiredMixin, ObjectUpdate)
|
|||||||
return req
|
return req
|
||||||
|
|
||||||
|
|
||||||
|
class BanksRequisitionDelete(LoginRequiredMixin, OTPRequiredMixin, ObjectDelete):
|
||||||
|
model = Requisition
|
||||||
|
|
||||||
|
|
||||||
class BanksCurrencies(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
class BanksCurrencies(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
||||||
"""
|
"""
|
||||||
Get a list of bank accounts with their details.
|
Get a list of bank accounts with their details.
|
||||||
|
Loading…
Reference in New Issue
Block a user