From 16dba4381084fa593e9019c97345f5833ed12a0c Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 25 Dec 2022 16:24:40 +0100 Subject: [PATCH] Reformat template files with djLint --- nummi/main/templates/main/base.html | 116 +++++++------ nummi/main/templates/main/category.html | 42 ++--- nummi/main/templates/main/form.html | 14 +- nummi/main/templates/main/index.html | 127 +++++++------- nummi/main/templates/main/login.html | 51 +++--- nummi/main/templates/main/snapshot.html | 160 ++++++++---------- .../main/templates/main/tag/form_buttons.html | 22 ++- nummi/main/templates/main/tag/pmvalue.html | 11 +- .../templates/main/tag/transaction_table.html | 73 ++++---- nummi/main/templates/main/tag/value.html | 8 +- nummi/main/templates/main/transaction.html | 107 ++++++------ nummi/main/templates/main/transactions.html | 51 +++--- 12 files changed, 384 insertions(+), 398 deletions(-) diff --git a/nummi/main/templates/main/base.html b/nummi/main/templates/main/base.html index 4672d76..ff91452 100644 --- a/nummi/main/templates/main/base.html +++ b/nummi/main/templates/main/base.html @@ -2,58 +2,66 @@ {% load i18n %} - - - - - {% block title %}Nummi{% endblock %} - - {% block link %} - - - - - {% endblock %} - - - {% block nav %} - {% spaceless %} - - {% endspaceless %} - {% endblock %} - {% block body %} - {% endblock %} - + + + + + {% block title %}Nummi{% endblock %} + + {% block link %} + + + + + {% endblock %} + + + {% block nav %} + {% spaceless %} + + {% endspaceless %} + {% endblock %} + {% block body %}{% endblock %} + diff --git a/nummi/main/templates/main/category.html b/nummi/main/templates/main/category.html index 5ec8ab8..17c71fd 100644 --- a/nummi/main/templates/main/category.html +++ b/nummi/main/templates/main/category.html @@ -2,26 +2,28 @@ {% load static %} {% load main_extras %} {% load i18n %} - {% block link %} -{{ block.super }} - - + {{ block.super }} + + {% endblock %} - {% block body %} -

{{ category }}

- -
- {% csrf_token %} - {{ form }} - {% form_buttons category %} -
- -{% if transactions %} -Graph representing value over time - -

{% translate "Transactions" %}

-{% transaction_table transactions %} -{% endif %} -{% endblock %} +

+ {{ category }} +

+
+ {% csrf_token %} + {{ form }} + {% form_buttons category %} +
+ {% if transactions %} + Graph representing value over time +

{% translate "Transactions" %}

+ {% transaction_table transactions %} + {% endif %} + {% endblock %} diff --git a/nummi/main/templates/main/form.html b/nummi/main/templates/main/form.html index e69f304..692f781 100644 --- a/nummi/main/templates/main/form.html +++ b/nummi/main/templates/main/form.html @@ -1,12 +1,10 @@ {% if form.non_field_errors %} - + {% endif %} {% for field in form %} -{{ field.errors }} - -
{{ field }}
+ {{ field.errors }} + +
{{ field }}
{% endfor %} diff --git a/nummi/main/templates/main/index.html b/nummi/main/templates/main/index.html index 3c68739..6dd6534 100644 --- a/nummi/main/templates/main/index.html +++ b/nummi/main/templates/main/index.html @@ -2,72 +2,69 @@ {% load static %} {% load main_extras %} {% load i18n %} - {% block link %} -{{ block.super }} - - + {{ block.super }} + + {% endblock %} - {% block body %} -{% if transactions %} -

{% translate "Transactions" %}

-{% transaction_table transactions %} -{% endif %} - -{% if categories %} -

{% translate "Categories" %}

-
- {% for cat in categories %} - {{ cat }} - {% endfor %} -
-{% endif %} - -{% if snapshots %} -

{% translate "Snapshots" %}

-
-
- - {% translate "Date" %} - {% translate "Value" %} - {% translate "Difference" %} - {% translate "Transactions" %} - {% translate "Valid" %} -
- {% for snap in snapshots %} -
- - {% if snap.file %} - - - - {% endif %} - - - {{ snap.date|date:"Y-m-d" }} - - {{ snap.value|value }} - - {{ snap.diff|pmvalue }} - - {% with sum=snap.sum %} - - {{ sum|pmvalue }} - - - {% if snap.previous is not None %} - {% if sum == snap.diff %} - - {% else %} - - {% endif %} - {% endif %} - - {% endwith %} -
- {% endfor %} -
-{% endif %} - + {% if transactions %} +

+ {% translate "Transactions" %} +

+ {% transaction_table transactions %} + {% endif %} + {% if categories %} +

{% translate "Categories" %}

+
+ {% for cat in categories %} + {{ cat }} + {% endfor %} +
+ {% endif %} + {% if snapshots %} +

{% translate "Snapshots" %}

+
+
+ + {% translate "Date" %} + {% translate "Value" %} + {% translate "Difference" %} + {% translate "Transactions" %} + {% translate "Valid" %} +
+ {% for snap in snapshots %} +
+ + {% if snap.file %} + + + + {% endif %} + + + {{ snap.date|date:"Y-m-d" }} + + {{ snap.value|value }} + {{ snap.diff|pmvalue }} + {% with sum=snap.sum %} + {{ sum|pmvalue }} + + {% if snap.previous is not None %} + {% if sum == snap.diff %} + + {% else %} + + {% endif %} + {% endif %} + + {% endwith %} +
+ {% endfor %} +
+ {% endif %} {% endblock %} diff --git a/nummi/main/templates/main/login.html b/nummi/main/templates/main/login.html index cca26dd..67218e5 100644 --- a/nummi/main/templates/main/login.html +++ b/nummi/main/templates/main/login.html @@ -1,35 +1,30 @@ {% extends "main/base.html" %} {% load static %} {% load i18n %} - {% block link %} -{{ block.super }} - + {{ block.super }} + {% endblock %} - {% block body %} - -

{% translate "Log In" %}

- -
- {% csrf_token %} - {% if form.non_field_errors %} - - {% endif %} - {% for field in form %} - {{ field.errors }} - -
{{ field }}
- {% endfor %} -
- - - -
-
- +

{% translate "Log In" %}

+
+ {% csrf_token %} + {% if form.non_field_errors %} + + {% endif %} + {% for field in form %} + {{ field.errors }} + +
{{ field }}
+ {% endfor %} +
+ + + +
+
{% endblock %} diff --git a/nummi/main/templates/main/snapshot.html b/nummi/main/templates/main/snapshot.html index 7396a02..55d9b88 100644 --- a/nummi/main/templates/main/snapshot.html +++ b/nummi/main/templates/main/snapshot.html @@ -2,91 +2,81 @@ {% load static %} {% load main_extras %} {% load i18n %} - {% block link %} -{{ block.super }} - - - + {{ block.super }} + + + {% endblock %} - {% block body %} -{% with sum=snapshot.sum %} -

- {% if snapshot.previous is not None %} - {% if sum == snapshot.diff %} - - {% else %} - - {% endif %} - {% endif %} - {{ snapshot }} -

- -
- {% csrf_token %} - {{ form }} - {% form_buttons snapshot %} -
- -{% if categories %} -

{% translate "Categories" %}

-
- {% for cat in categories %} -
- {% if cat.category %} - - - {{ cat.category__name }} - - {% else %} - - {% endif %} -
-
- {{ cat.sum_m|pmvalue }} -
-
-
-
- {% if cat.sum < 0 %} -
- {{ cat.sum|pmvalue }} -
- {% endif %} -
-
-
-
- {% if cat.sum >= 0 %} -
- {{ cat.sum|pmvalue }} -
- {% endif %} -
-
- {{ cat.sum_p|pmvalue }} -
- {% endfor %} -
-{% endif %} - -{% if snapshot.transactions %} -

{% translate "Transactions" %} ({{ sum|pmvalue }} / {{ snapshot.diff|pmvalue }})

- -{% transaction_table snapshot.transactions %} -{% endif %} -{% endwith %} -{% endblock %} + {% with sum=snapshot.sum %} +

+ {% if snapshot.previous is not None %} + {% if sum == snapshot.diff %} + + {% else %} + + {% endif %} + {% endif %} + {{ snapshot }} +

+
+ {% csrf_token %} + {{ form }} + {% form_buttons snapshot %} +
+ {% if categories %} +

{% translate "Categories" %}

+
+ {% for cat in categories %} +
+ {% if cat.category %} + + {{ cat.category__name }} + {% else %} + + {% endif %} +
+
{{ cat.sum_m|pmvalue }}
+
+
+ {% if cat.sum < 0 %} +
+ {{ cat.sum|pmvalue }} +
+ {% endif %} +
+
+
+ {% if cat.sum >= 0 %} +
+ {{ cat.sum|pmvalue }} +
+ {% endif %} +
+
{{ cat.sum_p|pmvalue }}
+ {% endfor %} +
+ {% endif %} + {% if snapshot.transactions %} +

{% translate "Transactions" %} ({{ sum|pmvalue }} / {{ snapshot.diff|pmvalue }})

+ {% transaction_table snapshot.transactions %} + {% endif %} + {% endwith %} + {% endblock %} diff --git a/nummi/main/templates/main/tag/form_buttons.html b/nummi/main/templates/main/tag/form_buttons.html index 86cf785..54c39db 100644 --- a/nummi/main/templates/main/tag/form_buttons.html +++ b/nummi/main/templates/main/tag/form_buttons.html @@ -1,15 +1,13 @@ {% load i18n %}
- {% if not adding %} - {% translate "Delete" as del %} - - {{ del }} - - - {% endif %} - - + {% if not adding %} + {% translate "Delete" as del %} + + {{ del }} + + {% endif %} + +
diff --git a/nummi/main/templates/main/tag/pmvalue.html b/nummi/main/templates/main/tag/pmvalue.html index 306aa87..db9eb45 100644 --- a/nummi/main/templates/main/tag/pmvalue.html +++ b/nummi/main/templates/main/tag/pmvalue.html @@ -1,8 +1,9 @@ {% extends "main/tag/value.html" %} - {% block "value" %} - {% if value %} - {% if value > 0 %}+{% endif %} - {{ block.super }} - {% else %}–{% endif %} + {% if value %} + {% if value > 0 %}+{% endif %} + {{ block.super }} + {% else %} + – + {% endif %} {% endblock %} diff --git a/nummi/main/templates/main/tag/transaction_table.html b/nummi/main/templates/main/tag/transaction_table.html index 299c513..b1a1263 100644 --- a/nummi/main/templates/main/tag/transaction_table.html +++ b/nummi/main/templates/main/tag/transaction_table.html @@ -1,42 +1,39 @@ {% load main_extras %} {% load i18n %} -
-
- - {% translate "Date" %} - {% translate "Name" %} - {% translate "Value" %} - {% translate "Trader" %} - {% translate "Category" %} - {% translate "Description" %} -
- {% for trans in transactions %} -
- - {% for invoice in trans.invoices %} - {% spaceless %} - - - - {% endspaceless %} - {% endfor %} - - {{ trans.date|date:"Y-m-d" }} - {{ trans.name }} - {{ trans.value|pmvalue }} - {{ trans.trader|default_if_none:"–" }} - - {% if trans.category %} - - - {{ trans.category }} - - {% else %} - – - {% endif %} - - {{ trans.description }} -
- {% endfor %} +
+ + {% translate "Date" %} + {% translate "Name" %} + {% translate "Value" %} + {% translate "Trader" %} + {% translate "Category" %} + {% translate "Description" %} +
+ {% for trans in transactions %} +
+ + {% for invoice in trans.invoices %} + {% spaceless %} + + + + {% endspaceless %} + {% endfor %} + + {{ trans.date|date:"Y-m-d" }} + {{ trans.name }} + {{ trans.value|pmvalue }} + {{ trans.trader|default_if_none:"–" }} + + {% if trans.category %} + + {{ trans.category }} + {% else %} + – + {% endif %} + + {{ trans.description }} +
+ {% endfor %}
diff --git a/nummi/main/templates/main/tag/value.html b/nummi/main/templates/main/tag/value.html index 9ba2cf7..3cdbb41 100644 --- a/nummi/main/templates/main/tag/value.html +++ b/nummi/main/templates/main/tag/value.html @@ -1,7 +1,5 @@ {% spaceless %} - - {% block "value" %} - {{ value }} € - {% endblock %} - + + {% block "value" %}{{ value }} €{% endblock %} + {% endspaceless %} diff --git a/nummi/main/templates/main/transaction.html b/nummi/main/templates/main/transaction.html index 0009651..fe34167 100644 --- a/nummi/main/templates/main/transaction.html +++ b/nummi/main/templates/main/transaction.html @@ -2,57 +2,62 @@ {% load static %} {% load main_extras %} {% load i18n %} - {% block link %} -{{ block.super }} - - + {{ block.super }} + + {% endblock %} - {% block body %} -

{{ transaction }}

- -{% spaceless %} -
- {% csrf_token %} - - {{ form }} - {% form_buttons transaction %} -
-{% endspaceless %} - -
- {% if transaction.has_invoice %} -
-

{% translate "Invoices" %}

-
-
- - {% translate "Name" %} - -
- {% for inv in transaction.invoices %} - - {% endfor %} -
-
- {% endif %} - -
-

{% translate "Add invoice" %}

-
- {% csrf_token %} - - {{ invoice_form }} -
-
-
-
-{% endblock %} +

{{ transaction }}

+ {% spaceless %} +
+ {% csrf_token %} + + {{ form }} + {% form_buttons transaction %} +
+ {% endspaceless %} +
+ {% if transaction.has_invoice %} +
+

{% translate "Invoices" %}

+
+
+ + {% translate "Name" %} + +
+ {% for inv in transaction.invoices %} + + {% endfor %} +
+
+ {% endif %} +
+

{% translate "Add invoice" %}

+
+ {% csrf_token %} + + {{ invoice_form }} +
+ +
+
+
+
+ {% endblock %} diff --git a/nummi/main/templates/main/transactions.html b/nummi/main/templates/main/transactions.html index edf421e..eeca920 100644 --- a/nummi/main/templates/main/transactions.html +++ b/nummi/main/templates/main/transactions.html @@ -2,34 +2,31 @@ {% load static %} {% load main_extras %} {% load i18n %} - {% block link %} -{{ block.super }} - - + {{ block.super }} + + {% endblock %} - {% block body %} -

{% translate "Transactions" %}

-{% transaction_table transactions %} - -{% if page_obj %} - -{% endif %} +

{% translate "Transactions" %}

+ {% transaction_table transactions %} + {% if page_obj %} + + {% endif %} {% endblock %}