Fix history plot

Fix 
This commit is contained in:
Edgar P. Burkhart 2025-01-03 14:55:16 +01:00
parent c14e075cad
commit 5b49836bad
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
4 changed files with 10 additions and 6 deletions
nummi
account/templates/account
category/templates/category
history/templatetags
transaction

View file

@ -22,6 +22,6 @@
</section>
<section>
<h3>{% translate "History" %}</h3>
{% history_plot account.transactions %}
{% history_plot account.transactions account=account %}
</section>
{% endblock body %}

View file

@ -20,6 +20,6 @@
</section>
<section>
<h3>{% translate "History" %}</h3>
{% history_plot category.transaction_set.all %}
{% history_plot category.transaction_set category=category %}
</section>
{% endblock body %}

View file

@ -10,9 +10,13 @@ register = template.Library()
@register.inclusion_tag("history/plot.html")
def history_plot(transactions, **kwargs):
return kwargs | {
"history": history(transactions.exclude(category__budget=False)),
}
options = kwargs
if "category" in kwargs or "account" in kwargs:
options["history"] = history(transactions.all())
else:
options["history"] = history(transactions.exclude(category__budget=False))
return options
@register.simple_tag

View file

@ -136,7 +136,7 @@ class TransactionACMixin:
Account.objects.filter(user=self.request.user),
pk=self.kwargs["account"],
)
return super().get_queryset().filter(account=self.account)
return super().get_queryset().filter(statement__account=self.account)
if "category" in self.kwargs:
self.category = get_object_or_404(
Category.objects.filter(user=self.request.user),