Compare commits
4 commits
757ce1f45f
...
d8c95fac25
Author | SHA1 | Date | |
---|---|---|---|
d8c95fac25 | |||
a48e34281f | |||
e911cdcf6b | |||
60631b77b7 |
8 changed files with 84 additions and 82 deletions
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 0.0.1\n"
|
"Project-Id-Version: 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: 2022-12-21 17:30+0100\n"
|
||||||
"Last-Translator: edpibu <git@edgarpierre.fr>\n"
|
"Last-Translator: edpibu <git@edgarpierre.fr>\n"
|
||||||
"Language-Team: edpibu <git@edgarpierre.fr>\n"
|
"Language-Team: edpibu <git@edgarpierre.fr>\n"
|
||||||
|
@ -17,90 +17,89 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n > 1);\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\base.html:44
|
||||||
#: .\main\templates\main\tag\transaction_table.html:10
|
#: .\main\templates\main\tag\transaction_table.html:10
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr "Catégorie"
|
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\tag\transaction_table.html:7
|
||||||
#: .\main\templates\main\transaction.html:33
|
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Nom"
|
msgstr "Nom"
|
||||||
|
|
||||||
#: .\main\models.py:17
|
#: .\main\models.py:18
|
||||||
msgid "Icon"
|
msgid "Icon"
|
||||||
msgstr "Icône"
|
msgstr "Icône"
|
||||||
|
|
||||||
#: .\main\models.py:18
|
#: .\main\models.py:19
|
||||||
msgid "Budget"
|
msgid "Budget"
|
||||||
msgstr "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
|
#: .\main\templates\main\snapshot.html:37
|
||||||
msgid "Categories"
|
msgid "Categories"
|
||||||
msgstr "Catégories"
|
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"
|
msgid "Transaction"
|
||||||
msgstr "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"
|
msgid "Description"
|
||||||
msgstr "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
|
#: .\main\templates\main\tag\transaction_table.html:8
|
||||||
msgid "Value"
|
msgid "Value"
|
||||||
msgstr "Valeur"
|
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
|
#: .\main\templates\main\tag\transaction_table.html:6
|
||||||
msgid "Date"
|
msgid "Date"
|
||||||
msgstr "Date"
|
msgstr "Date"
|
||||||
|
|
||||||
#: .\main\models.py:47
|
#: .\main\models.py:48
|
||||||
msgid "Real date"
|
msgid "Real date"
|
||||||
msgstr "Date réelle"
|
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"
|
msgid "Trader"
|
||||||
msgstr "Commerçant"
|
msgstr "Commerçant"
|
||||||
|
|
||||||
#: .\main\models.py:52
|
#: .\main\models.py:53
|
||||||
msgid "Payment"
|
msgid "Payment"
|
||||||
msgstr "Paiement"
|
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\index.html:17 .\main\templates\main\index.html:42
|
||||||
#: .\main\templates\main\snapshot.html:78
|
#: .\main\templates\main\snapshot.html:78
|
||||||
#: .\main\templates\main\transactions.html:15
|
#: .\main\templates\main\transactions.html:15
|
||||||
msgid "Transactions"
|
msgid "Transactions"
|
||||||
msgstr "Transactions"
|
msgstr "Transactions"
|
||||||
|
|
||||||
#: .\main\models.py:103 .\main\models.py:121
|
#: .\main\models.py:107 .\main\models.py:125
|
||||||
msgid "Invoice"
|
msgid "Invoice"
|
||||||
msgstr "Facture"
|
msgstr "Facture"
|
||||||
|
|
||||||
#: .\main\models.py:108 .\main\models.py:153
|
#: .\main\models.py:112 .\main\models.py:157
|
||||||
msgid "File"
|
msgid "File"
|
||||||
msgstr "Fichier"
|
msgstr "Fichier"
|
||||||
|
|
||||||
#: .\main\models.py:122 .\main\templates\main\transaction.html:29
|
#: .\main\models.py:126
|
||||||
msgid "Invoices"
|
msgid "Invoices"
|
||||||
msgstr "Factures"
|
msgstr "Factures"
|
||||||
|
|
||||||
#: .\main\models.py:159
|
#: .\main\models.py:163
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%(date)s snapshot"
|
msgid "%(date)s snapshot"
|
||||||
msgstr "Relevé du %(date)s"
|
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"
|
msgid "Snapshot"
|
||||||
msgstr "Relevé"
|
msgstr "Relevé"
|
||||||
|
|
||||||
#: .\main\models.py:262 .\main\templates\main\index.html:35
|
#: .\main\models.py:266 .\main\templates\main\index.html:35
|
||||||
msgid "Snapshots"
|
msgid "Snapshots"
|
||||||
msgstr "Relevés"
|
msgstr "Relevés"
|
||||||
|
|
||||||
|
@ -112,6 +111,19 @@ msgstr "Rechercher"
|
||||||
msgid "Log out"
|
msgid "Log out"
|
||||||
msgstr "Se déconnecter"
|
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
|
#: .\main\templates\main\index.html:41
|
||||||
msgid "Difference"
|
msgid "Difference"
|
||||||
msgstr "Différence"
|
msgstr "Différence"
|
||||||
|
@ -125,19 +137,15 @@ msgid "Log In"
|
||||||
msgstr "Se connecter"
|
msgstr "Se connecter"
|
||||||
|
|
||||||
#: .\main\templates\main\tag\form_buttons.html:4
|
#: .\main\templates\main\tag\form_buttons.html:4
|
||||||
#: .\main\templates\main\transaction.html:42
|
|
||||||
#: .\main\templates\main\transaction.html:43
|
|
||||||
msgid "Delete"
|
msgid "Delete"
|
||||||
msgstr "Supprimer"
|
msgstr "Supprimer"
|
||||||
|
|
||||||
#: .\main\templates\main\tag\form_buttons.html:12
|
#: .\main\templates\main\tag\form_buttons.html:8
|
||||||
msgid "Save"
|
msgid "Save"
|
||||||
msgstr "Enregistrer"
|
msgstr "Enregistrer"
|
||||||
|
|
||||||
#: .\main\templates\main\transaction.html:51
|
#~ msgid "Add invoice"
|
||||||
msgid "Add invoice"
|
#~ msgstr "Ajouter une facture"
|
||||||
msgstr "Ajouter une facture"
|
|
||||||
|
|
||||||
#: .\main\templates\main\transaction.html:59
|
#~ msgid "Add"
|
||||||
msgid "Add"
|
#~ msgstr "Ajouter"
|
||||||
msgstr "Ajouter"
|
|
||||||
|
|
|
@ -16,10 +16,12 @@ form ul.errorlist {
|
||||||
|
|
||||||
form input,
|
form input,
|
||||||
form select,
|
form select,
|
||||||
form textarea,
|
|
||||||
form a {
|
form a {
|
||||||
padding: 0 var(--gap);
|
padding: 0 var(--gap);
|
||||||
}
|
}
|
||||||
|
form textarea {
|
||||||
|
padding: var(--gap);
|
||||||
|
}
|
||||||
|
|
||||||
form input {
|
form input {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
@ -79,7 +81,8 @@ form > .buttons > *:hover {
|
||||||
form > .buttons input[type="submit"] {
|
form > .buttons input[type="submit"] {
|
||||||
background: var(--green-1);
|
background: var(--green-1);
|
||||||
}
|
}
|
||||||
form > .buttons a.del {
|
form > .buttons a.del,
|
||||||
|
form > .buttons input.del {
|
||||||
background: var(--red);
|
background: var(--red);
|
||||||
color: var(--text-inv);
|
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">
|
<div class="buttons">
|
||||||
{% if not adding %}
|
{% if not adding %}
|
||||||
{% translate "Delete" as del %}
|
{% translate "Delete" as del %}
|
||||||
<a class="btn del"
|
<a class="btn del" href="{% url del_url instance.id %}">{{ del }}</a>
|
||||||
onclick="return confirm('{{ del }} <{{ instance }}> ?')"
|
|
||||||
href="{% url del_url instance.id %}">
|
|
||||||
{{ del }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input type="reset" />
|
<input type="reset" />
|
||||||
<input type="submit" value="{% translate 'Save' %}" />
|
<input type="submit" value="{% translate 'Save' %}" />
|
||||||
|
|
|
@ -9,7 +9,11 @@ urlpatterns = [
|
||||||
path("transactions", views.TransactionListView.as_view(), name="transactions"),
|
path("transactions", views.TransactionListView.as_view(), name="transactions"),
|
||||||
path("transaction", views.TransactionCreateView.as_view(), name="transaction"),
|
path("transaction", views.TransactionCreateView.as_view(), name="transaction"),
|
||||||
path("transaction/<pk>", views.TransactionUpdateView.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("del_invoice/<uuid>/<invoice_id>", views.del_invoice, name="del_invoice"),
|
||||||
path("invoice/<uuid>", views.invoice, name="invoice"),
|
path("invoice/<uuid>", views.invoice, name="invoice"),
|
||||||
path("category", views.category, name="category"),
|
path("category", views.category, name="category"),
|
||||||
|
|
|
@ -11,7 +11,8 @@ from django.core.paginator import Paginator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
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 (
|
from .models import (
|
||||||
Category,
|
Category,
|
||||||
|
@ -55,43 +56,6 @@ class TransactionListView(LoginRequiredMixin, ListView):
|
||||||
context_object_name = "transactions"
|
context_object_name = "transactions"
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def transaction(request, uuid=None):
|
|
||||||
_form = None
|
|
||||||
_inv_form = None
|
|
||||||
if request.method == "GET":
|
|
||||||
if uuid is None:
|
|
||||||
_transaction = Transaction()
|
|
||||||
else:
|
|
||||||
_transaction = get_object_or_404(Transaction, id=uuid)
|
|
||||||
elif request.method == "POST":
|
|
||||||
if request.POST["form"] == "transaction":
|
|
||||||
_transaction, _ = Transaction.objects.get_or_create(id=uuid)
|
|
||||||
_form = TransactionForm(request.POST, instance=_transaction)
|
|
||||||
if _form.is_valid():
|
|
||||||
_form.save()
|
|
||||||
return redirect(transaction, uuid=uuid)
|
|
||||||
_inv_form = InvoiceForm(instance=Invoice(transaction=_transaction))
|
|
||||||
elif request.POST["form"] == "invoice":
|
|
||||||
_transaction = get_object_or_404(Transaction, id=uuid)
|
|
||||||
_invoice = Invoice(transaction=_transaction)
|
|
||||||
_inv_form = InvoiceForm(request.POST, request.FILES, instance=_invoice)
|
|
||||||
if _inv_form.is_valid():
|
|
||||||
_inv_form.save()
|
|
||||||
return redirect(transaction, uuid=uuid)
|
|
||||||
|
|
||||||
return render(
|
|
||||||
request,
|
|
||||||
"main/transaction.html",
|
|
||||||
{
|
|
||||||
"transaction": _transaction,
|
|
||||||
"form": _form or TransactionForm(instance=_transaction),
|
|
||||||
"invoice_form": _inv_form
|
|
||||||
or InvoiceForm(instance=Invoice(transaction=_transaction)),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TransactionCreateView(LoginRequiredMixin, CreateView):
|
class TransactionCreateView(LoginRequiredMixin, CreateView):
|
||||||
model = Transaction
|
model = Transaction
|
||||||
form_class = TransactionForm
|
form_class = TransactionForm
|
||||||
|
@ -102,11 +66,10 @@ class TransactionUpdateView(LoginRequiredMixin, UpdateView):
|
||||||
form_class = TransactionForm
|
form_class = TransactionForm
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
class TransactionDeleteView(LoginRequiredMixin, DeleteView):
|
||||||
def del_transaction(request, uuid):
|
model = Transaction
|
||||||
_transaction = get_object_or_404(Transaction, id=uuid)
|
template_name = "main/confirm_delete.html"
|
||||||
_transaction.delete()
|
success_url = reverse_lazy("index")
|
||||||
return redirect(index)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue