Show title as New on forms

This commit is contained in:
Edgar P. Burkhart 2023-04-20 11:28:06 +02:00
parent 9263af0d40
commit 110a699f1a
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
9 changed files with 71 additions and 45 deletions

View file

@ -10,7 +10,7 @@ class NummiFileInput(forms.ClearableFileInput):
class NummiForm(forms.ModelForm):
template_name = "main/form/base.html"
template_name = "main/form/form_base.html"
def __init__(self, *args, user, **kwargs):
super().__init__(*args, **kwargs)

View file

@ -16,12 +16,17 @@
type="text/css" />
{% endblock %}
{% block body %}
<h1>{{ form.instance.icon|remix }}{{ form.instance }}</h1>
{% with account=form.instance %}
{% if account.adding %}
<h1>{% translate "New account" %}</h1>
{% else %}
<h1>{{ account.icon|remix }}{{ account }}</h1>
{% endif %}
<form method="post">
{% csrf_token %}
{{ form }}
</form>
{% if not form.instance.adding %}
{% if not account.adding %}
<h2>{% translate "Statements" %}</h2>
{% include "main/table/snapshot.html" %}
{% endif %}
@ -31,4 +36,5 @@
<h2>{% translate "History" %}</h2>
{% include "main/plot/history.html" %}
{% endif %}
{% endwith %}
{% endblock %}

View file

@ -16,15 +16,21 @@
type="text/css" />
{% endblock %}
{% block body %}
<h1>{{ form.instance.icon|remix }}{{ form.instance }}</h1>
{% with category=form.instance %}
{% if category.adding %}
<h1>{% translate "New category" %}</h1>
{% else %}
<h1>{{ category.icon|remix }}{{ category }}</h1>
{% endif %}
<form method="post">
{% csrf_token %}
{{ form }}
</form>
{% if form.instance.transactions %}
{% if category.transactions %}
<h2>{% translate "Transactions" %}</h2>
{% include "main/table/transaction.html" %}
<h2>{% translate "History" %}</h2>
{% include "main/plot/history.html" %}
{% endif %}
{% endwith %}
{% endblock %}

View file

@ -14,7 +14,11 @@
{% endblock %}
{% block body %}
{% with invoice=form.instance %}
{% if invoice.adding %}
<h1>{% translate "New invoice" %}</h1>
{% else %}
<h1>{{ invoice }}</h1>
{% endif %}
<p>
<a href="{{ invoice.transaction.get_absolute_url }}">{{ invoice.transaction }}</a>
</p>

View file

@ -1,4 +1,4 @@
{% extends "main/form/base.html" %}
{% extends "main/form/form_base.html" %}
{% load i18n %}
{% block buttons %}
<input hidden value="{{ next }}" name="next" />

View file

@ -1,4 +1,4 @@
{% extends "main/form/base.html" %}
{% extends "main/form/form_base.html" %}
{% load i18n %}
{% block buttons %}
<input type="reset" />

View file

@ -17,10 +17,14 @@
{% endblock %}
{% block body %}
{% with snapshot=form.instance %}
{% if snapshot.adding %}
<h1>{% translate "New snapshot" %}</h1>
{% else %}
<h1>
<span class="ri-{% if snapshot.sum == snapshot.diff %}check-line green{% else %}close-line red{% endif %}"></span>
{{ snapshot }}
</h1>
{% endif %}
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}

View file

@ -13,7 +13,12 @@
type="text/css" />
{% endblock %}
{% block body %}
{% with transaction=form.instance %}
{% if transaction.adding %}
<h1>{% translate "New transaction" %}</h1>
{% else %}
<h1>{{ form.instance }}</h1>
{% endif %}
{% spaceless %}
<form id="transaction" method="post">
{% csrf_token %}
@ -24,4 +29,5 @@
<h2>{% translate "Invoices" %}</h2>
{% include "main/table/invoice.html" %}
{% endif %}
{% endwith %}
{% endblock %}