- {% translate "Categories" %}
- {% spaceless %}
-
- {% for cat in categories %}
- {{ cat.icon|remix }}{{ cat }}
- {% endfor %}
- {{ "add"|remix }}{% translate "Create category" %}
-
- {% endspaceless %}
+
+ {% translate "Statements" %}
+ {% include "statement/statement_table.html" %}
+
{% if history %}
{% translate "History" %}
diff --git a/nummi/main/views.py b/nummi/main/views.py
index 72e6840..2786ed9 100644
--- a/nummi/main/views.py
+++ b/nummi/main/views.py
@@ -25,20 +25,23 @@ class IndexView(LoginRequiredMixin, TemplateView):
def get_context_data(self, **kwargs):
_max = 8
_transactions = Transaction.objects.filter(user=self.request.user)
- _statements = Statement.objects.filter(user=self.request.user)
_accounts = Account.objects.filter(user=self.request.user)
+ _statements = (
+ Statement.objects.filter(user=self.request.user)
+ .exclude(account__archived=True)
+ .order_by("account__id", "-date")
+ .distinct("account__id")
+ )
res = {
"accounts": _accounts,
- "transactions": _transactions[:_max],
"categories": Category.objects.filter(user=self.request.user),
- "statements": _statements[:_max],
+ "statements": _statements,
"history": history(_transactions.exclude(category__budget=False)),
}
if _transactions.count() > _max:
res["transactions_url"] = reverse_lazy("transactions")
- if _statements.count() > _max:
- res["statements_url"] = reverse_lazy("statements")
+ res["statements_url"] = reverse_lazy("statements")
return super().get_context_data(**kwargs) | res