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" %}
|
||||
{% load main_extras %}
|
||||
{% load main_extras statement_extras %}
|
||||
{% load i18n %}
|
||||
{% block title %}{{ object }} – {{ block.super }}{% endblock %}
|
||||
{% block title %}
|
||||
{{ object }} – {{ block.super }}
|
||||
{% endblock title %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
{% css "main/css/table.css" %}
|
||||
{% css "main/css/plot.css" %}
|
||||
{% endblock %}
|
||||
{% endblock link %}
|
||||
{% block body %}
|
||||
<h2>{{ object.icon|remix }}{{ object }}</h2>
|
||||
<p>
|
||||
|
@ -14,7 +16,7 @@
|
|||
</p>
|
||||
<section>
|
||||
<h3>{% translate "Statements" %}</h3>
|
||||
{% include "statement/statement_table.html" %}
|
||||
{% statement_table statements statements_url=statements_url new_statement_url=new_statement_url %}
|
||||
</section>
|
||||
{% if history %}
|
||||
<section>
|
||||
|
@ -22,4 +24,4 @@
|
|||
{% include "history/plot.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock body %}
|
||||
|
|
|
@ -9,6 +9,7 @@ from main.views import (
|
|||
NummiUpdateView,
|
||||
)
|
||||
from statement.views import StatementListView
|
||||
from transaction.models import Transaction
|
||||
from transaction.views import TransactionListView
|
||||
|
||||
from .forms import AccountForm
|
||||
|
@ -51,7 +52,7 @@ class AccountDetailView(NummiDetailView):
|
|||
"new_statement", kwargs={"account": account.pk}
|
||||
),
|
||||
"statements": _statements[:_max],
|
||||
"history": history(account.transaction_set),
|
||||
"history": history(Transaction.objects.filter(statement__account=account)),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "main/base.html" %}
|
||||
{% load static %}
|
||||
{% load main_extras account_extras %}
|
||||
{% load main_extras account_extras statement_extras %}
|
||||
{% load i18n %}
|
||||
{% block link %}
|
||||
{{ block.super }}
|
||||
|
@ -16,7 +16,7 @@
|
|||
</section>
|
||||
<section>
|
||||
<h2>{% translate "Statements" %}</h2>
|
||||
{% include "statement/statement_table.html" %}
|
||||
{% statement_table statements statements_url=statements_url %}
|
||||
</section>
|
||||
</div>
|
||||
<section>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{% extends "main/list.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n statement_extras %}
|
||||
{% block name %}
|
||||
{% translate "Statements" %}
|
||||
{% endblock %}
|
||||
{% endblock name %}
|
||||
{% block h2 %}
|
||||
{% translate "Statements" %}
|
||||
{% endblock %}
|
||||
{% endblock h2 %}
|
||||
{% block table %}
|
||||
{% url "new_statement" as new_statement_url %}
|
||||
{% include "statement/statement_table.html" %}
|
||||
{% endblock %}
|
||||
{% statement_table statements new_statement_url=new_statement_url %}
|
||||
{% endblock table %}
|
||||
|
|
|
@ -12,3 +12,10 @@ def check(s, diff):
|
|||
return remix("check", "green")
|
||||
else:
|
||||
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