Use templatetags for statement_table
This commit is contained in:
parent
090f1a3a5c
commit
786d7c2130
5 changed files with 23 additions and 13 deletions
|
@ -1,12 +1,14 @@
|
||||||
{% extends "main/base.html" %}
|
{% extends "main/base.html" %}
|
||||||
{% load main_extras %}
|
{% load main_extras statement_extras %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
{% block title %}
|
||||||
|
{{ object }} – {{ block.super }}
|
||||||
|
{% endblock title %}
|
||||||
{% block link %}
|
{% block link %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% css "main/css/table.css" %}
|
{% css "main/css/table.css" %}
|
||||||
{% css "main/css/plot.css" %}
|
{% css "main/css/plot.css" %}
|
||||||
{% endblock %}
|
{% endblock link %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h2>{{ object.icon|remix }}{{ object }}</h2>
|
<h2>{{ object.icon|remix }}{{ object }}</h2>
|
||||||
<p>
|
<p>
|
||||||
|
@ -14,7 +16,7 @@
|
||||||
</p>
|
</p>
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Statements" %}</h3>
|
<h3>{% translate "Statements" %}</h3>
|
||||||
{% include "statement/statement_table.html" %}
|
{% statement_table statements statements_url=statements_url new_statement_url=new_statement_url %}
|
||||||
</section>
|
</section>
|
||||||
{% if history %}
|
{% if history %}
|
||||||
<section>
|
<section>
|
||||||
|
@ -22,4 +24,4 @@
|
||||||
{% include "history/plot.html" %}
|
{% include "history/plot.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock body %}
|
||||||
|
|
|
@ -9,6 +9,7 @@ from main.views import (
|
||||||
NummiUpdateView,
|
NummiUpdateView,
|
||||||
)
|
)
|
||||||
from statement.views import StatementListView
|
from statement.views import StatementListView
|
||||||
|
from transaction.models import Transaction
|
||||||
from transaction.views import TransactionListView
|
from transaction.views import TransactionListView
|
||||||
|
|
||||||
from .forms import AccountForm
|
from .forms import AccountForm
|
||||||
|
@ -51,7 +52,7 @@ class AccountDetailView(NummiDetailView):
|
||||||
"new_statement", kwargs={"account": account.pk}
|
"new_statement", kwargs={"account": account.pk}
|
||||||
),
|
),
|
||||||
"statements": _statements[:_max],
|
"statements": _statements[:_max],
|
||||||
"history": history(account.transaction_set),
|
"history": history(Transaction.objects.filter(statement__account=account)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "main/base.html" %}
|
{% extends "main/base.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load main_extras account_extras %}
|
{% load main_extras account_extras statement_extras %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block link %}
|
{% block link %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h2>{% translate "Statements" %}</h2>
|
<h2>{% translate "Statements" %}</h2>
|
||||||
{% include "statement/statement_table.html" %}
|
{% statement_table statements statements_url=statements_url %}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{% extends "main/list.html" %}
|
{% extends "main/list.html" %}
|
||||||
{% load i18n %}
|
{% load i18n statement_extras %}
|
||||||
{% block name %}
|
{% block name %}
|
||||||
{% translate "Statements" %}
|
{% translate "Statements" %}
|
||||||
{% endblock %}
|
{% endblock name %}
|
||||||
{% block h2 %}
|
{% block h2 %}
|
||||||
{% translate "Statements" %}
|
{% translate "Statements" %}
|
||||||
{% endblock %}
|
{% endblock h2 %}
|
||||||
{% block table %}
|
{% block table %}
|
||||||
{% url "new_statement" as new_statement_url %}
|
{% url "new_statement" as new_statement_url %}
|
||||||
{% include "statement/statement_table.html" %}
|
{% statement_table statements new_statement_url=new_statement_url %}
|
||||||
{% endblock %}
|
{% endblock table %}
|
||||||
|
|
|
@ -12,3 +12,10 @@ def check(s, diff):
|
||||||
return remix("check", "green")
|
return remix("check", "green")
|
||||||
else:
|
else:
|
||||||
return remix("close", "red")
|
return remix("close", "red")
|
||||||
|
|
||||||
|
|
||||||
|
@register.inclusion_tag("statement/statement_table.html")
|
||||||
|
def statement_table(statements, **kwargs):
|
||||||
|
return kwargs | {
|
||||||
|
"statements": statements,
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue