Show title as New on forms
This commit is contained in:
parent
9263af0d40
commit
110a699f1a
9 changed files with 71 additions and 45 deletions
|
@ -10,7 +10,7 @@ class NummiFileInput(forms.ClearableFileInput):
|
||||||
|
|
||||||
|
|
||||||
class NummiForm(forms.ModelForm):
|
class NummiForm(forms.ModelForm):
|
||||||
template_name = "main/form/base.html"
|
template_name = "main/form/form_base.html"
|
||||||
|
|
||||||
def __init__(self, *args, user, **kwargs):
|
def __init__(self, *args, user, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
|
@ -16,12 +16,17 @@
|
||||||
type="text/css" />
|
type="text/css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% 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">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
</form>
|
</form>
|
||||||
{% if not form.instance.adding %}
|
{% if not account.adding %}
|
||||||
<h2>{% translate "Statements" %}</h2>
|
<h2>{% translate "Statements" %}</h2>
|
||||||
{% include "main/table/snapshot.html" %}
|
{% include "main/table/snapshot.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -31,4 +36,5 @@
|
||||||
<h2>{% translate "History" %}</h2>
|
<h2>{% translate "History" %}</h2>
|
||||||
{% include "main/plot/history.html" %}
|
{% include "main/plot/history.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -16,15 +16,21 @@
|
||||||
type="text/css" />
|
type="text/css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% 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">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
</form>
|
</form>
|
||||||
{% if form.instance.transactions %}
|
{% if category.transactions %}
|
||||||
<h2>{% translate "Transactions" %}</h2>
|
<h2>{% translate "Transactions" %}</h2>
|
||||||
{% include "main/table/transaction.html" %}
|
{% include "main/table/transaction.html" %}
|
||||||
<h2>{% translate "History" %}</h2>
|
<h2>{% translate "History" %}</h2>
|
||||||
{% include "main/plot/history.html" %}
|
{% include "main/plot/history.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,7 +14,11 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% with invoice=form.instance %}
|
{% with invoice=form.instance %}
|
||||||
|
{% if invoice.adding %}
|
||||||
|
<h1>{% translate "New invoice" %}</h1>
|
||||||
|
{% else %}
|
||||||
<h1>{{ invoice }}</h1>
|
<h1>{{ invoice }}</h1>
|
||||||
|
{% endif %}
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ invoice.transaction.get_absolute_url }}">{{ invoice.transaction }}</a>
|
<a href="{{ invoice.transaction.get_absolute_url }}">{{ invoice.transaction }}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "main/form/base.html" %}
|
{% extends "main/form/form_base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block buttons %}
|
{% block buttons %}
|
||||||
<input hidden value="{{ next }}" name="next" />
|
<input hidden value="{{ next }}" name="next" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "main/form/base.html" %}
|
{% extends "main/form/form_base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block buttons %}
|
{% block buttons %}
|
||||||
<input type="reset" />
|
<input type="reset" />
|
||||||
|
|
|
@ -17,10 +17,14 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% with snapshot=form.instance %}
|
{% with snapshot=form.instance %}
|
||||||
|
{% if snapshot.adding %}
|
||||||
|
<h1>{% translate "New snapshot" %}</h1>
|
||||||
|
{% else %}
|
||||||
<h1>
|
<h1>
|
||||||
<span class="ri-{% if snapshot.sum == snapshot.diff %}check-line green{% else %}close-line red{% endif %}"></span>
|
<span class="ri-{% if snapshot.sum == snapshot.diff %}check-line green{% else %}close-line red{% endif %}"></span>
|
||||||
{{ snapshot }}
|
{{ snapshot }}
|
||||||
</h1>
|
</h1>
|
||||||
|
{% endif %}
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
|
|
|
@ -13,7 +13,12 @@
|
||||||
type="text/css" />
|
type="text/css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
{% with transaction=form.instance %}
|
||||||
|
{% if transaction.adding %}
|
||||||
|
<h1>{% translate "New transaction" %}</h1>
|
||||||
|
{% else %}
|
||||||
<h1>{{ form.instance }}</h1>
|
<h1>{{ form.instance }}</h1>
|
||||||
|
{% endif %}
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<form id="transaction" method="post">
|
<form id="transaction" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -24,4 +29,5 @@
|
||||||
<h2>{% translate "Invoices" %}</h2>
|
<h2>{% translate "Invoices" %}</h2>
|
||||||
{% include "main/table/invoice.html" %}
|
{% include "main/table/invoice.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue