Compare commits
No commits in common. "d8c95fac253a321e835e9bb6cee935f17e814920" and "757ce1f45f147c2c5d9d07ad46e3829526339774" have entirely different histories.
d8c95fac25
...
757ce1f45f
8 changed files with 82 additions and 84 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-28 10:16+0100\n"
|
||||
"POT-Creation-Date: 2022-12-26 18:10+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,89 +17,90 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#: .\main\models.py:16 .\main\models.py:26 .\main\models.py:60
|
||||
#: .\main\models.py:15 .\main\models.py:25 .\main\models.py:59
|
||||
#: .\main\templates\main\base.html:44
|
||||
#: .\main\templates\main\tag\transaction_table.html:10
|
||||
msgid "Category"
|
||||
msgstr "Catégorie"
|
||||
|
||||
#: .\main\models.py:16 .\main\models.py:41 .\main\models.py:107
|
||||
#: .\main\models.py:15 .\main\models.py:40 .\main\models.py:103
|
||||
#: .\main\templates\main\tag\transaction_table.html:7
|
||||
#: .\main\templates\main\transaction.html:33
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#: .\main\models.py:18
|
||||
#: .\main\models.py:17
|
||||
msgid "Icon"
|
||||
msgstr "Icône"
|
||||
|
||||
#: .\main\models.py:19
|
||||
#: .\main\models.py:18
|
||||
msgid "Budget"
|
||||
msgstr "Budget"
|
||||
|
||||
#: .\main\models.py:27 .\main\templates\main\index.html:25
|
||||
#: .\main\models.py:26 .\main\templates\main\index.html:25
|
||||
#: .\main\templates\main\snapshot.html:37
|
||||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
#: .\main\models.py:41 .\main\models.py:79 .\main\templates\main\base.html:39
|
||||
#: .\main\models.py:40 .\main\models.py:75 .\main\templates\main\base.html:39
|
||||
msgid "Transaction"
|
||||
msgstr "Transaction"
|
||||
|
||||
#: .\main\models.py:43 .\main\templates\main\tag\transaction_table.html:11
|
||||
#: .\main\models.py:42 .\main\templates\main\tag\transaction_table.html:11
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
#: .\main\models.py:45 .\main\models.py:146 .\main\templates\main\index.html:40
|
||||
#: .\main\models.py:44 .\main\models.py:142 .\main\templates\main\index.html:40
|
||||
#: .\main\templates\main\tag\transaction_table.html:8
|
||||
msgid "Value"
|
||||
msgstr "Valeur"
|
||||
|
||||
#: .\main\models.py:47 .\main\models.py:144 .\main\templates\main\index.html:39
|
||||
#: .\main\models.py:46 .\main\models.py:140 .\main\templates\main\index.html:39
|
||||
#: .\main\templates\main\tag\transaction_table.html:6
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#: .\main\models.py:48
|
||||
#: .\main\models.py:47
|
||||
msgid "Real date"
|
||||
msgstr "Date réelle"
|
||||
|
||||
#: .\main\models.py:50 .\main\templates\main\tag\transaction_table.html:9
|
||||
#: .\main\models.py:49 .\main\templates\main\tag\transaction_table.html:9
|
||||
msgid "Trader"
|
||||
msgstr "Commerçant"
|
||||
|
||||
#: .\main\models.py:53
|
||||
#: .\main\models.py:52
|
||||
msgid "Payment"
|
||||
msgstr "Paiement"
|
||||
|
||||
#: .\main\models.py:80 .\main\templates\main\category.html:26
|
||||
#: .\main\models.py:76 .\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:107 .\main\models.py:125
|
||||
#: .\main\models.py:103 .\main\models.py:121
|
||||
msgid "Invoice"
|
||||
msgstr "Facture"
|
||||
|
||||
#: .\main\models.py:112 .\main\models.py:157
|
||||
#: .\main\models.py:108 .\main\models.py:153
|
||||
msgid "File"
|
||||
msgstr "Fichier"
|
||||
|
||||
#: .\main\models.py:126
|
||||
#: .\main\models.py:122 .\main\templates\main\transaction.html:29
|
||||
msgid "Invoices"
|
||||
msgstr "Factures"
|
||||
|
||||
#: .\main\models.py:163
|
||||
#: .\main\models.py:159
|
||||
#, python-format
|
||||
msgid "%(date)s snapshot"
|
||||
msgstr "Relevé du %(date)s"
|
||||
|
||||
#: .\main\models.py:265 .\main\templates\main\base.html:49
|
||||
#: .\main\models.py:261 .\main\templates\main\base.html:49
|
||||
msgid "Snapshot"
|
||||
msgstr "Relevé"
|
||||
|
||||
#: .\main\models.py:266 .\main\templates\main\index.html:35
|
||||
#: .\main\models.py:262 .\main\templates\main\index.html:35
|
||||
msgid "Snapshots"
|
||||
msgstr "Relevés"
|
||||
|
||||
|
@ -111,19 +112,6 @@ 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"
|
||||
|
@ -137,15 +125,19 @@ 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:8
|
||||
#: .\main\templates\main\tag\form_buttons.html:12
|
||||
msgid "Save"
|
||||
msgstr "Enregistrer"
|
||||
|
||||
#~ msgid "Add invoice"
|
||||
#~ msgstr "Ajouter une facture"
|
||||
#: .\main\templates\main\transaction.html:51
|
||||
msgid "Add invoice"
|
||||
msgstr "Ajouter une facture"
|
||||
|
||||
#~ msgid "Add"
|
||||
#~ msgstr "Ajouter"
|
||||
#: .\main\templates\main\transaction.html:59
|
||||
msgid "Add"
|
||||
msgstr "Ajouter"
|
||||
|
|
|
@ -16,12 +16,10 @@ form ul.errorlist {
|
|||
|
||||
form input,
|
||||
form select,
|
||||
form textarea,
|
||||
form a {
|
||||
padding: 0 var(--gap);
|
||||
}
|
||||
form textarea {
|
||||
padding: var(--gap);
|
||||
}
|
||||
|
||||
form input {
|
||||
color: inherit;
|
||||
|
@ -81,8 +79,7 @@ form > .buttons > *:hover {
|
|||
form > .buttons input[type="submit"] {
|
||||
background: var(--green-1);
|
||||
}
|
||||
form > .buttons a.del,
|
||||
form > .buttons input.del {
|
||||
form > .buttons a.del {
|
||||
background: var(--red);
|
||||
color: var(--text-inv);
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
{% 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,7 +2,11 @@
|
|||
<div class="buttons">
|
||||
{% if not adding %}
|
||||
{% translate "Delete" as del %}
|
||||
<a class="btn del" href="{% url del_url instance.id %}">{{ del }}</a>
|
||||
<a class="btn del"
|
||||
onclick="return confirm('{{ del }} <{{ instance }}> ?')"
|
||||
href="{% url del_url instance.id %}">
|
||||
{{ del }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<input type="reset" />
|
||||
<input type="submit" value="{% translate 'Save' %}" />
|
||||
|
|
|
@ -9,11 +9,7 @@ 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/delete/<pk>",
|
||||
views.TransactionDeleteView.as_view(),
|
||||
name="del_transaction",
|
||||
),
|
||||
path("transaction/<uuid>/del", views.del_transaction, 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,8 +11,7 @@ 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.urls import reverse_lazy
|
||||
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
||||
from django.views.generic import CreateView, ListView, UpdateView
|
||||
|
||||
from .models import (
|
||||
Category,
|
||||
|
@ -56,6 +55,43 @@ class TransactionListView(LoginRequiredMixin, ListView):
|
|||
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):
|
||||
model = Transaction
|
||||
form_class = TransactionForm
|
||||
|
@ -66,10 +102,11 @@ class TransactionUpdateView(LoginRequiredMixin, UpdateView):
|
|||
form_class = TransactionForm
|
||||
|
||||
|
||||
class TransactionDeleteView(LoginRequiredMixin, DeleteView):
|
||||
model = Transaction
|
||||
template_name = "main/confirm_delete.html"
|
||||
success_url = reverse_lazy("index")
|
||||
@login_required
|
||||
def del_transaction(request, uuid):
|
||||
_transaction = get_object_or_404(Transaction, id=uuid)
|
||||
_transaction.delete()
|
||||
return redirect(index)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
Loading…
Reference in a new issue