Separate detail and edit view for category, update statement page
This commit is contained in:
parent
218a6aca6f
commit
9d50dc7154
15 changed files with 120 additions and 96 deletions
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-01-04 16:04+0100\n"
|
"POT-Creation-Date: 2024-01-04 16:18+0100\n"
|
||||||
"PO-Revision-Date: 2023-04-22 15:17+0200\n"
|
"PO-Revision-Date: 2023-04-22 15:17+0200\n"
|
||||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -37,19 +37,19 @@ msgstr "Défaut"
|
||||||
msgid "Accounts"
|
msgid "Accounts"
|
||||||
msgstr "Comptes"
|
msgstr "Comptes"
|
||||||
|
|
||||||
#: .\account\templates\account\account_detail.html:15
|
#: .\account\templates\account\account_detail.html:13
|
||||||
msgid "Edit account"
|
msgid "Edit account"
|
||||||
msgstr "Modifier le compte"
|
msgstr "Modifier le compte"
|
||||||
|
|
||||||
#: .\account\templates\account\account_detail.html:17
|
#: .\account\templates\account\account_detail.html:16
|
||||||
msgid "Statements"
|
msgid "Statements"
|
||||||
msgstr "Relevés"
|
msgstr "Relevés"
|
||||||
|
|
||||||
#: .\account\templates\account\account_detail.html:21
|
#: .\account\templates\account\account_detail.html:20
|
||||||
msgid "Transactions"
|
msgid "Transactions"
|
||||||
msgstr "Transactions"
|
msgstr "Transactions"
|
||||||
|
|
||||||
#: .\account\templates\account\account_detail.html:26
|
#: .\account\templates\account\account_detail.html:25
|
||||||
msgid "History"
|
msgid "History"
|
||||||
msgstr "Historique"
|
msgstr "Historique"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
||||||
{% block link %}
|
{% block link %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% css "main/css/form.css" %}
|
|
||||||
{% css "main/css/table.css" %}
|
{% css "main/css/table.css" %}
|
||||||
{% css "main/css/plot.css" %}
|
{% css "main/css/plot.css" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -24,31 +24,6 @@ class AccountUpdateView(NummiUpdateView):
|
||||||
form_class = AccountForm
|
form_class = AccountForm
|
||||||
pk_url_kwarg = "account"
|
pk_url_kwarg = "account"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
_max = 8
|
|
||||||
data = super().get_context_data(**kwargs)
|
|
||||||
account = data["form"].instance
|
|
||||||
|
|
||||||
_transactions = account.transaction_set.all()
|
|
||||||
if _transactions.count() > _max:
|
|
||||||
data["transactions_url"] = reverse_lazy(
|
|
||||||
"account_transactions", args=(account.pk,)
|
|
||||||
)
|
|
||||||
_statements = account.statement_set.all()
|
|
||||||
if _statements.count() > _max:
|
|
||||||
data["statements_url"] = reverse_lazy(
|
|
||||||
"account_statements", args=(account.pk,)
|
|
||||||
)
|
|
||||||
|
|
||||||
return data | {
|
|
||||||
"transactions": _transactions[:8],
|
|
||||||
"new_statement_url": reverse_lazy(
|
|
||||||
"new_statement", kwargs={"account": account.pk}
|
|
||||||
),
|
|
||||||
"statements": _statements[:8],
|
|
||||||
"history": history(account.transaction_set),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class AccountDeleteView(NummiDeleteView):
|
class AccountDeleteView(NummiDeleteView):
|
||||||
model = Account
|
model = Account
|
||||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-01-02 15:52+0100\n"
|
"POT-Creation-Date: 2024-01-04 16:18+0100\n"
|
||||||
"PO-Revision-Date: 2023-04-22 15:18+0200\n"
|
"PO-Revision-Date: 2023-04-22 15:18+0200\n"
|
||||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -38,6 +38,18 @@ msgstr "Budget"
|
||||||
msgid "Categories"
|
msgid "Categories"
|
||||||
msgstr "Catégories"
|
msgstr "Catégories"
|
||||||
|
|
||||||
|
#: .\category\templates\category\category_detail.html:12
|
||||||
|
msgid "Edit category"
|
||||||
|
msgstr "Modifier la catégorie"
|
||||||
|
|
||||||
|
#: .\category\templates\category\category_detail.html:15
|
||||||
|
msgid "Transactions"
|
||||||
|
msgstr "Transactions"
|
||||||
|
|
||||||
|
#: .\category\templates\category\category_detail.html:20
|
||||||
|
msgid "History"
|
||||||
|
msgstr "Historique"
|
||||||
|
|
||||||
#: .\category\templates\category\category_form.html:5
|
#: .\category\templates\category\category_form.html:5
|
||||||
msgid "Create category"
|
msgid "Create category"
|
||||||
msgstr "Créer une catégorie"
|
msgstr "Créer une catégorie"
|
||||||
|
@ -46,14 +58,6 @@ msgstr "Créer une catégorie"
|
||||||
msgid "New category"
|
msgid "New category"
|
||||||
msgstr "Nouvelle catégorie"
|
msgstr "Nouvelle catégorie"
|
||||||
|
|
||||||
#: .\category\templates\category\category_form.html:13
|
|
||||||
msgid "Transactions"
|
|
||||||
msgstr "Transactions"
|
|
||||||
|
|
||||||
#: .\category\templates\category\category_form.html:18
|
|
||||||
msgid "History"
|
|
||||||
msgstr "Historique"
|
|
||||||
|
|
||||||
#: .\category\templates\category\category_plot.html:15
|
#: .\category\templates\category\category_plot.html:15
|
||||||
msgid "Expenses"
|
msgid "Expenses"
|
||||||
msgstr "Dépenses"
|
msgstr "Dépenses"
|
||||||
|
|
24
nummi/category/templates/category/category_detail.html
Normal file
24
nummi/category/templates/category/category_detail.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{% extends "main/base.html" %}
|
||||||
|
{% load main_extras i18n %}
|
||||||
|
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
||||||
|
{% block link %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% css "main/css/table.css" %}
|
||||||
|
{% css "main/css/plot.css" %}
|
||||||
|
{% endblock %}
|
||||||
|
{% block body %}
|
||||||
|
<h2>{{ object.icon|remix }}{{ object }}</h2>
|
||||||
|
<p>
|
||||||
|
<a href="{% url "edit_category" object.pk %}">{% translate "Edit category" %}</a>
|
||||||
|
</p>
|
||||||
|
<section>
|
||||||
|
<h3>{% translate "Transactions" %}</h3>
|
||||||
|
{% include "transaction/transaction_table.html" %}
|
||||||
|
</section>
|
||||||
|
{% if history %}
|
||||||
|
<section>
|
||||||
|
<h3>{% translate "History" %}</h3>
|
||||||
|
{% include "history/plot.html" %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
|
@ -8,15 +8,3 @@
|
||||||
{% translate "New category" %}
|
{% translate "New category" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
{% block h2 %}{{ form.instance.icon|remix }}{{ form.instance }}{% endblock %}
|
||||||
{% block tables %}
|
|
||||||
<section>
|
|
||||||
<h3>{% translate "Transactions" %}</h3>
|
|
||||||
{% include "transaction/transaction_table.html" %}
|
|
||||||
</section>
|
|
||||||
{% if history %}
|
|
||||||
<section>
|
|
||||||
<h3>{% translate "History" %}</h3>
|
|
||||||
{% include "history/plot.html" %}
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% load main_extras %}
|
{% load main_extras category %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="plot">
|
<div class="plot">
|
||||||
<table class="full-width">
|
<table class="full-width">
|
||||||
|
@ -34,14 +34,14 @@
|
||||||
<td class="c">
|
<td class="c">
|
||||||
{% if cat.category %}{{ cat.category__icon|remix }}{% endif %}
|
{% if cat.category %}{{ cat.category__icon|remix }}{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="value">{{ cat.sum_m|pmrvalue }}</td>
|
<td class="value">{{ cat.sum_m|pmvalue }}</td>
|
||||||
<td class="bar m">
|
<td class="bar m">
|
||||||
{% if cat.sum_m %}
|
{% if cat.sum_m %}
|
||||||
<div style="width: {% widthratio cat.sum_m max -100 %}%"></div>
|
<div style="width: {% widthratio cat.sum_m max -100 %}%"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if cat.sum < 0 %}
|
{% if cat.sum < 0 %}
|
||||||
<div class="tot" style="width:{% widthratio cat.sum max -100 %}%">
|
<div class="tot" style="width:{% widthratio cat.sum max -100 %}%">
|
||||||
<span>{{ cat.sum|pmrvalue }}</span>
|
<span>{{ cat.sum|pmvalue }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
@ -51,11 +51,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if cat.sum > 0 %}
|
{% if cat.sum > 0 %}
|
||||||
<div class="tot" style="width:{% widthratio cat.sum max 100 %}%">
|
<div class="tot" style="width:{% widthratio cat.sum max 100 %}%">
|
||||||
<span>{{ cat.sum|pmrvalue }}</span>
|
<span>{{ cat.sum|pmvalue }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="value">{{ cat.sum_p|pmrvalue }}</td>
|
<td class="value">{{ cat.sum_p|pmvalue }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -64,16 +64,16 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
</tbody>
|
</tbody>
|
||||||
{% if categories %}
|
<tfoot>
|
||||||
<tfoot>
|
{% if categories %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" colspan="2" class="l">{% translate "Total" %}</th>
|
<th scope="row" colspan="2" class="l">{% translate "Total" %}</th>
|
||||||
<td class="value">{{ total_m|pmrvalue }}</td>
|
<td class="value">{{ total_m|pmvalue }}</td>
|
||||||
<td class="bar m">
|
<td class="bar m">
|
||||||
<div style="width: {% widthratio total_m max -100 %}%"></div>
|
<div style="width: {% widthratio total_m max -100 %}%"></div>
|
||||||
{% if total < 0 %}
|
{% if total < 0 %}
|
||||||
<div class="tot" style="width:{% widthratio total max -100 %}%">
|
<div class="tot" style="width:{% widthratio total max -100 %}%">
|
||||||
<span>{{ total|pmrvalue }}</span>
|
<span>{{ total|pmvalue }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
@ -81,13 +81,35 @@
|
||||||
<div style="width: {% widthratio total_p max 100 %}%"></div>
|
<div style="width: {% widthratio total_p max 100 %}%"></div>
|
||||||
{% if total > 0 %}
|
{% if total > 0 %}
|
||||||
<div class="tot" style="width:{% widthratio total max 100 %}%">
|
<div class="tot" style="width:{% widthratio total max 100 %}%">
|
||||||
<span>{{ total|pmrvalue }}</span>
|
<span>{{ total|pmvalue }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="value">{{ total_p|pmrvalue }}</td>
|
<td class="value">{{ total_p|pmvalue }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
{% endif %}
|
||||||
{% endif %}
|
{% if statement %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="l">{% translate "Expected total" %}</th>
|
||||||
|
<td class="c">{{ total|check:statement.diff }}</td>
|
||||||
|
<td></td>
|
||||||
|
<td class="bar m">
|
||||||
|
{% if statement.diff < 0 %}
|
||||||
|
<div class="tot" style="width:{% widthratio statement.diff max -100 %}%">
|
||||||
|
<span>{{ statement.diff|pmvalue }}</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td class="bar p">
|
||||||
|
{% if statement.diff >= 0 %}
|
||||||
|
<div class="tot" style="width:{% widthratio statement.diff max 100 %}%">
|
||||||
|
<span>{{ statement.diff|pmvalue }}</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
from django import template
|
from django import template
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.functions import Greatest
|
from django.db.models.functions import Greatest
|
||||||
|
from main.templatetags.main_extras import remix
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag("category/category_plot.html")
|
@register.inclusion_tag("category/category_plot.html")
|
||||||
def category_plot(transactions, **kwargs):
|
def category_plot(transactions, budget=True, **kwargs):
|
||||||
|
if budget:
|
||||||
|
transactions = transactions.exclude(category__budget=False)
|
||||||
categories = (
|
categories = (
|
||||||
transactions.exclude(category__budget=False)
|
transactions.values("category", "category__name", "category__icon")
|
||||||
.values("category", "category__name", "category__icon")
|
|
||||||
.annotate(
|
.annotate(
|
||||||
sum=models.Sum("value"),
|
sum=models.Sum("value"),
|
||||||
sum_m=models.Sum("value", filter=models.Q(value__lt=0)),
|
sum_m=models.Sum("value", filter=models.Q(value__lt=0)),
|
||||||
|
@ -29,3 +31,13 @@ def category_plot(transactions, **kwargs):
|
||||||
total=models.Sum("sum"),
|
total=models.Sum("sum"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def check(s, diff):
|
||||||
|
if s is None:
|
||||||
|
s = 0
|
||||||
|
if s == diff:
|
||||||
|
return remix("check", "green")
|
||||||
|
else:
|
||||||
|
return remix("close", "red")
|
||||||
|
|
|
@ -5,7 +5,8 @@ from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("new", views.CategoryCreateView.as_view(), name="new_category"),
|
path("new", views.CategoryCreateView.as_view(), name="new_category"),
|
||||||
path("<category>", views.CategoryUpdateView.as_view(), name="category"),
|
path("<category>", views.CategoryDetailView.as_view(), name="category"),
|
||||||
|
path("<category>/edit", views.CategoryUpdateView.as_view(), name="edit_category"),
|
||||||
path(
|
path(
|
||||||
"<category>/transactions",
|
"<category>/transactions",
|
||||||
views.CategoryTListView.as_view(),
|
views.CategoryTListView.as_view(),
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from history.utils import history
|
from history.utils import history
|
||||||
from main.views import NummiCreateView, NummiDeleteView, NummiUpdateView
|
from main.views import (
|
||||||
|
NummiCreateView,
|
||||||
|
NummiDeleteView,
|
||||||
|
NummiDetailView,
|
||||||
|
NummiUpdateView,
|
||||||
|
)
|
||||||
from transaction.views import TransactionListView
|
from transaction.views import TransactionListView
|
||||||
|
|
||||||
from .forms import CategoryForm
|
from .forms import CategoryForm
|
||||||
|
@ -18,10 +23,15 @@ class CategoryUpdateView(NummiUpdateView):
|
||||||
form_class = CategoryForm
|
form_class = CategoryForm
|
||||||
pk_url_kwarg = "category"
|
pk_url_kwarg = "category"
|
||||||
|
|
||||||
|
|
||||||
|
class CategoryDetailView(NummiDetailView):
|
||||||
|
model = Category
|
||||||
|
pk_url_kwarg = "category"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
_max = 8
|
_max = 8
|
||||||
data = super().get_context_data(**kwargs)
|
data = super().get_context_data(**kwargs)
|
||||||
category = data["form"].instance
|
category = data["object"]
|
||||||
|
|
||||||
data["transactions"] = category.transaction_set.all()[:_max]
|
data["transactions"] = category.transaction_set.all()[:_max]
|
||||||
if len(data["transactions"]) == _max:
|
if len(data["transactions"]) == _max:
|
||||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2024-01-04 16:04+0100\n"
|
"POT-Creation-Date: 2024-01-04 16:18+0100\n"
|
||||||
"PO-Revision-Date: 2023-04-23 08:03+0200\n"
|
"PO-Revision-Date: 2023-04-23 08:03+0200\n"
|
||||||
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
"Last-Translator: Edgar P. Burkhart <traduction@edgarpierre.fr>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
@ -101,27 +101,27 @@ msgstr "Compte"
|
||||||
msgid "Balance"
|
msgid "Balance"
|
||||||
msgstr "Solde"
|
msgstr "Solde"
|
||||||
|
|
||||||
#: .\main\templates\main\index.html:19 .\main\templates\main\index.html:30
|
#: .\main\templates\main\index.html:19 .\main\templates\main\index.html:31
|
||||||
msgid "Edit"
|
msgid "Edit"
|
||||||
msgstr "Modifier"
|
msgstr "Modifier"
|
||||||
|
|
||||||
#: .\main\templates\main\index.html:34
|
#: .\main\templates\main\index.html:36
|
||||||
msgid "No account"
|
msgid "No account"
|
||||||
msgstr "Aucun compte"
|
msgstr "Aucun compte"
|
||||||
|
|
||||||
#: .\main\templates\main\index.html:41
|
#: .\main\templates\main\index.html:43
|
||||||
msgid "Create account"
|
msgid "Create account"
|
||||||
msgstr "Créer un compte"
|
msgstr "Créer un compte"
|
||||||
|
|
||||||
#: .\main\templates\main\index.html:48
|
#: .\main\templates\main\index.html:50
|
||||||
msgid "Categories"
|
msgid "Categories"
|
||||||
msgstr "Catégories"
|
msgstr "Catégories"
|
||||||
|
|
||||||
#: .\main\templates\main\index.html:54
|
#: .\main\templates\main\index.html:56
|
||||||
msgid "Create category"
|
msgid "Create category"
|
||||||
msgstr "Créer une catégorie"
|
msgstr "Créer une catégorie"
|
||||||
|
|
||||||
#: .\main\templates\main\index.html:61
|
#: .\main\templates\main\index.html:63
|
||||||
msgid "History"
|
msgid "History"
|
||||||
msgstr "Historique"
|
msgstr "Historique"
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ table.full-width col.bar {
|
||||||
td.bar {
|
td.bar {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
@media (width < 720px) {
|
@media (width < 720px) {
|
||||||
width: 0;
|
width: 0;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
|
|
|
@ -8,16 +8,16 @@ register = template.Library()
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def value(val, pm=False, r=2):
|
def value(val, pm=False, r=2):
|
||||||
if not val:
|
if val is None:
|
||||||
return ""
|
return ""
|
||||||
_prefix = ""
|
_prefix = ""
|
||||||
_suffix = " €"
|
_suffix = " €"
|
||||||
_val = formats.number_format(round(val, r), r, use_l10n=True, force_grouping=True)
|
_val = formats.number_format(val, decimal_pos=r, use_l10n=True, force_grouping=True)
|
||||||
|
|
||||||
if val > 0:
|
if val > 0:
|
||||||
if pm:
|
if pm:
|
||||||
_prefix += "+ "
|
_prefix += "+ "
|
||||||
else:
|
elif val < 0:
|
||||||
_val = _val[1:]
|
_val = _val[1:]
|
||||||
_prefix += "− "
|
_prefix += "− "
|
||||||
|
|
||||||
|
@ -39,14 +39,6 @@ def remix(icon, cls=""):
|
||||||
return mark_safe(f"""<span class="ri-{icon}-line {cls}"></span>""")
|
return mark_safe(f"""<span class="ri-{icon}-line {cls}"></span>""")
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
|
||||||
def check(sum, diff):
|
|
||||||
if sum == diff:
|
|
||||||
return remix("check", "green")
|
|
||||||
else:
|
|
||||||
return remix("close", "red")
|
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def extension(file):
|
def extension(file):
|
||||||
return file.name.split(".")[-1].upper()
|
return file.name.split(".")[-1].upper()
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
{% block h2_new %}
|
{% block h2_new %}
|
||||||
{% translate "New statement" %}
|
{% translate "New statement" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block h2 %}
|
{% block h2 %}{{ form.instance }}{% endblock %}
|
||||||
{{ form.instance.sum|check:form.instance.diff }}
|
|
||||||
{{ form.instance }}
|
|
||||||
{% endblock %}
|
|
||||||
{% block pre %}
|
{% block pre %}
|
||||||
{% if account %}
|
{% if account %}
|
||||||
<p>
|
<p>
|
||||||
|
@ -21,10 +18,10 @@
|
||||||
{% if not form.instance|adding %}
|
{% if not form.instance|adding %}
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Categories" %}</h3>
|
<h3>{% translate "Categories" %}</h3>
|
||||||
{% category_plot transactions %}
|
{% category_plot transactions budget=False statement=object %}
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Transactions" %} ({{ form.instance.sum|pmvalue }} / {{ form.instance.diff|pmvalue }})</h3>
|
<h3>{% translate "Transactions" %}</h3>
|
||||||
{% include "transaction/transaction_table.html" %}
|
{% include "transaction/transaction_table.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue