Add back link to list pages

This commit is contained in:
Edgar P. Burkhart 2022-12-31 11:34:25 +01:00
parent 39896129a6
commit 94671b9ac4
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 17 additions and 0 deletions

View file

@ -13,6 +13,7 @@
{% endblock %}
{% block body %}
<h1>{% translate "Statements" %}</h1>
{% if object %}<a href="{{ object.get_absolute_url }}">{{ object }}</a>{% endif %}
{% if snapshots %}
{% include "main/table/snapshot.html" %}
{% if page_obj %}

View file

@ -13,6 +13,7 @@
{% endblock %}
{% block body %}
<h1>{% translate "Transactions" %}</h1>
{% if object %}<a href="{{ object.get_absolute_url }}">{{ object }}</a>{% endif %}
{% if transactions %}
{% include "main/table/transaction.html" %}
{% if page_obj %}

View file

@ -235,6 +235,11 @@ class AccountMixin:
def get_queryset(self):
return super().get_queryset().filter(account=self.kwargs.get("pk"))
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"object": Account.objects.get(pk=self.kwargs.get("pk"))
}
class AccountTListView(AccountMixin, TransactionListView):
pass
@ -248,11 +253,21 @@ class SnapshotTListView(TransactionListView):
def get_queryset(self):
return super().get_queryset().filter(snapshot=self.kwargs.get("pk"))
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"object": Snapshot.objects.get(pk=self.kwargs.get("pk"))
}
class CategoryTListView(TransactionListView):
def get_queryset(self):
return super().get_queryset().filter(category=self.kwargs.get("pk"))
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"object": Category.objects.get(pk=self.kwargs.get("pk"))
}
class SearchView(TransactionListView):
def post(self, *args, **kwargs):