Added delete view for transaction
This commit is contained in:
parent
a48e34281f
commit
d8c95fac25
7 changed files with 80 additions and 43 deletions
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: 0.0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-12-26 18:10+0100\n"
|
||||
"POT-Creation-Date: 2022-12-28 10:16+0100\n"
|
||||
"PO-Revision-Date: 2022-12-21 17:30+0100\n"
|
||||
"Last-Translator: edpibu <git@edgarpierre.fr>\n"
|
||||
"Language-Team: edpibu <git@edgarpierre.fr>\n"
|
||||
|
@ -17,90 +17,89 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#: .\main\models.py:15 .\main\models.py:25 .\main\models.py:59
|
||||
#: .\main\models.py:16 .\main\models.py:26 .\main\models.py:60
|
||||
#: .\main\templates\main\base.html:44
|
||||
#: .\main\templates\main\tag\transaction_table.html:10
|
||||
msgid "Category"
|
||||
msgstr "Catégorie"
|
||||
|
||||
#: .\main\models.py:15 .\main\models.py:40 .\main\models.py:103
|
||||
#: .\main\models.py:16 .\main\models.py:41 .\main\models.py:107
|
||||
#: .\main\templates\main\tag\transaction_table.html:7
|
||||
#: .\main\templates\main\transaction.html:33
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#: .\main\models.py:17
|
||||
#: .\main\models.py:18
|
||||
msgid "Icon"
|
||||
msgstr "Icône"
|
||||
|
||||
#: .\main\models.py:18
|
||||
#: .\main\models.py:19
|
||||
msgid "Budget"
|
||||
msgstr "Budget"
|
||||
|
||||
#: .\main\models.py:26 .\main\templates\main\index.html:25
|
||||
#: .\main\models.py:27 .\main\templates\main\index.html:25
|
||||
#: .\main\templates\main\snapshot.html:37
|
||||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
#: .\main\models.py:40 .\main\models.py:75 .\main\templates\main\base.html:39
|
||||
#: .\main\models.py:41 .\main\models.py:79 .\main\templates\main\base.html:39
|
||||
msgid "Transaction"
|
||||
msgstr "Transaction"
|
||||
|
||||
#: .\main\models.py:42 .\main\templates\main\tag\transaction_table.html:11
|
||||
#: .\main\models.py:43 .\main\templates\main\tag\transaction_table.html:11
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
#: .\main\models.py:44 .\main\models.py:142 .\main\templates\main\index.html:40
|
||||
#: .\main\models.py:45 .\main\models.py:146 .\main\templates\main\index.html:40
|
||||
#: .\main\templates\main\tag\transaction_table.html:8
|
||||
msgid "Value"
|
||||
msgstr "Valeur"
|
||||
|
||||
#: .\main\models.py:46 .\main\models.py:140 .\main\templates\main\index.html:39
|
||||
#: .\main\models.py:47 .\main\models.py:144 .\main\templates\main\index.html:39
|
||||
#: .\main\templates\main\tag\transaction_table.html:6
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#: .\main\models.py:47
|
||||
#: .\main\models.py:48
|
||||
msgid "Real date"
|
||||
msgstr "Date réelle"
|
||||
|
||||
#: .\main\models.py:49 .\main\templates\main\tag\transaction_table.html:9
|
||||
#: .\main\models.py:50 .\main\templates\main\tag\transaction_table.html:9
|
||||
msgid "Trader"
|
||||
msgstr "Commerçant"
|
||||
|
||||
#: .\main\models.py:52
|
||||
#: .\main\models.py:53
|
||||
msgid "Payment"
|
||||
msgstr "Paiement"
|
||||
|
||||
#: .\main\models.py:76 .\main\templates\main\category.html:26
|
||||
#: .\main\models.py:80 .\main\templates\main\category.html:26
|
||||
#: .\main\templates\main\index.html:17 .\main\templates\main\index.html:42
|
||||
#: .\main\templates\main\snapshot.html:78
|
||||
#: .\main\templates\main\transactions.html:15
|
||||
msgid "Transactions"
|
||||
msgstr "Transactions"
|
||||
|
||||
#: .\main\models.py:103 .\main\models.py:121
|
||||
#: .\main\models.py:107 .\main\models.py:125
|
||||
msgid "Invoice"
|
||||
msgstr "Facture"
|
||||
|
||||
#: .\main\models.py:108 .\main\models.py:153
|
||||
#: .\main\models.py:112 .\main\models.py:157
|
||||
msgid "File"
|
||||
msgstr "Fichier"
|
||||
|
||||
#: .\main\models.py:122 .\main\templates\main\transaction.html:29
|
||||
#: .\main\models.py:126
|
||||
msgid "Invoices"
|
||||
msgstr "Factures"
|
||||
|
||||
#: .\main\models.py:159
|
||||
#: .\main\models.py:163
|
||||
#, python-format
|
||||
msgid "%(date)s snapshot"
|
||||
msgstr "Relevé du %(date)s"
|
||||
|
||||
#: .\main\models.py:261 .\main\templates\main\base.html:49
|
||||
#: .\main\models.py:265 .\main\templates\main\base.html:49
|
||||
msgid "Snapshot"
|
||||
msgstr "Relevé"
|
||||
|
||||
#: .\main\models.py:262 .\main\templates\main\index.html:35
|
||||
#: .\main\models.py:266 .\main\templates\main\index.html:35
|
||||
msgid "Snapshots"
|
||||
msgstr "Relevés"
|
||||
|
||||
|
@ -112,6 +111,19 @@ msgstr "Rechercher"
|
|||
msgid "Log out"
|
||||
msgstr "Se déconnecter"
|
||||
|
||||
#: .\main\templates\main\confirm_delete.html:19
|
||||
#, python-format
|
||||
msgid "Are you sure you want do delete <%(object)s> ?"
|
||||
msgstr "Êtes-vous sûr de vouloir supprimer <%(object)s> ?"
|
||||
|
||||
#: .\main\templates\main\confirm_delete.html:23
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: .\main\templates\main\confirm_delete.html:24
|
||||
msgid "Confirm"
|
||||
msgstr "Confirmer"
|
||||
|
||||
#: .\main\templates\main\index.html:41
|
||||
msgid "Difference"
|
||||
msgstr "Différence"
|
||||
|
@ -125,19 +137,15 @@ msgid "Log In"
|
|||
msgstr "Se connecter"
|
||||
|
||||
#: .\main\templates\main\tag\form_buttons.html:4
|
||||
#: .\main\templates\main\transaction.html:42
|
||||
#: .\main\templates\main\transaction.html:43
|
||||
msgid "Delete"
|
||||
msgstr "Supprimer"
|
||||
|
||||
#: .\main\templates\main\tag\form_buttons.html:12
|
||||
#: .\main\templates\main\tag\form_buttons.html:8
|
||||
msgid "Save"
|
||||
msgstr "Enregistrer"
|
||||
|
||||
#: .\main\templates\main\transaction.html:51
|
||||
msgid "Add invoice"
|
||||
msgstr "Ajouter une facture"
|
||||
#~ msgid "Add invoice"
|
||||
#~ msgstr "Ajouter une facture"
|
||||
|
||||
#: .\main\templates\main\transaction.html:59
|
||||
msgid "Add"
|
||||
msgstr "Ajouter"
|
||||
#~ msgid "Add"
|
||||
#~ msgstr "Ajouter"
|
||||
|
|
|
@ -81,7 +81,8 @@ form > .buttons > *:hover {
|
|||
form > .buttons input[type="submit"] {
|
||||
background: var(--green-1);
|
||||
}
|
||||
form > .buttons a.del {
|
||||
form > .buttons a.del,
|
||||
form > .buttons input.del {
|
||||
background: var(--red);
|
||||
color: var(--text-inv);
|
||||
}
|
||||
|
|
28
nummi/main/templates/main/confirm_delete.html
Normal file
28
nummi/main/templates/main/confirm_delete.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
{% extends "main/base.html" %}
|
||||
{% load static %}
|
||||
{% load main_extras %}
|
||||
{% load i18n %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/form.css' %}"
|
||||
type="text/css"/>
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'main/css/table.css' %}"
|
||||
type="text/css"/>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% spaceless %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
{% blocktranslate %}Are you sure you want do delete <{{ object }}> ?{% endblocktranslate %}
|
||||
</p>
|
||||
{{ form }}
|
||||
<div class="buttons">
|
||||
<a class="btn" href="{{ object.get_absolute_url }}">{% translate "Cancel" %}</a>
|
||||
<input class="del" type="submit" value="{% translate "Confirm" %}" />
|
||||
</div>
|
||||
</form>
|
||||
{% endspaceless %}
|
||||
{% endblock %}
|
|
@ -2,11 +2,7 @@
|
|||
<div class="buttons">
|
||||
{% if not adding %}
|
||||
{% translate "Delete" as del %}
|
||||
<a class="btn del"
|
||||
onclick="return confirm('{{ del }} <{{ instance }}> ?')"
|
||||
href="{% url del_url instance.id %}">
|
||||
{{ del }}
|
||||
</a>
|
||||
<a class="btn del" href="{% url del_url instance.id %}">{{ del }}</a>
|
||||
{% endif %}
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate 'Save' %}" />
|
||||
|
|
|
@ -9,7 +9,11 @@ urlpatterns = [
|
|||
path("transactions", views.TransactionListView.as_view(), name="transactions"),
|
||||
path("transaction", views.TransactionCreateView.as_view(), name="transaction"),
|
||||
path("transaction/<pk>", views.TransactionUpdateView.as_view(), name="transaction"),
|
||||
path("transaction/<uuid>/del", views.del_transaction, name="del_transaction"),
|
||||
path(
|
||||
"transaction/delete/<pk>",
|
||||
views.TransactionDeleteView.as_view(),
|
||||
name="del_transaction",
|
||||
),
|
||||
path("del_invoice/<uuid>/<invoice_id>", views.del_invoice, name="del_invoice"),
|
||||
path("invoice/<uuid>", views.invoice, name="invoice"),
|
||||
path("category", views.category, name="category"),
|
||||
|
|
|
@ -11,7 +11,8 @@ from django.core.paginator import Paginator
|
|||
from django.db import models
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.views.generic import CreateView, ListView, UpdateView
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
||||
|
||||
from .models import (
|
||||
Category,
|
||||
|
@ -65,11 +66,10 @@ class TransactionUpdateView(LoginRequiredMixin, UpdateView):
|
|||
form_class = TransactionForm
|
||||
|
||||
|
||||
@login_required
|
||||
def del_transaction(request, uuid):
|
||||
_transaction = get_object_or_404(Transaction, id=uuid)
|
||||
_transaction.delete()
|
||||
return redirect(index)
|
||||
class TransactionDeleteView(LoginRequiredMixin, DeleteView):
|
||||
model = Transaction
|
||||
template_name = "main/confirm_delete.html"
|
||||
success_url = reverse_lazy("index")
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
Loading…
Reference in a new issue