Add delete button to transaction form
This commit is contained in:
parent
df0882bd88
commit
83aefe1f84
3 changed files with 9 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
||||||
{{ field }}
|
{{ field }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
<a href="{% url 'del_transaction' transaction.id %}"><input type="button" value="Delete" /></a>
|
||||||
<input type="reset" />
|
<input type="reset" />
|
||||||
<input type="submit" value="Save Transaction" />
|
<input type="submit" value="Save Transaction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,7 @@ urlpatterns = [
|
||||||
path(
|
path(
|
||||||
"transaction/<uuid>/update", views.update_transaction, name="update_transaction"
|
"transaction/<uuid>/update", views.update_transaction, name="update_transaction"
|
||||||
),
|
),
|
||||||
|
path("transaction/<uuid>/del", views.del_transaction, name="del_transaction"),
|
||||||
path("transaction/<uuid>/add_invoice", views.add_invoice, name="add_invoice"),
|
path("transaction/<uuid>/add_invoice", views.add_invoice, name="add_invoice"),
|
||||||
path(
|
path(
|
||||||
"transaction/<uuid>/del_invoice/<invoice_id>",
|
"transaction/<uuid>/del_invoice/<invoice_id>",
|
||||||
|
|
|
@ -66,6 +66,13 @@ def update_transaction(request, uuid):
|
||||||
return redirect(transaction, uuid=uuid)
|
return redirect(transaction, uuid=uuid)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def del_transaction(request, uuid):
|
||||||
|
_transaction = get_object_or_404(Transaction, id=uuid)
|
||||||
|
_transaction.delete()
|
||||||
|
return redirect(index)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def invoice(request, uuid):
|
def invoice(request, uuid):
|
||||||
_invoice = get_object_or_404(Invoice, id=uuid)
|
_invoice = get_object_or_404(Invoice, id=uuid)
|
||||||
|
|
Loading…
Reference in a new issue