parent
c14e075cad
commit
5b49836bad
4 changed files with 10 additions and 6 deletions
nummi
account/templates/account
category/templates/category
history/templatetags
transaction
|
@ -22,6 +22,6 @@
|
|||
</section>
|
||||
<section>
|
||||
<h3>{% translate "History" %}</h3>
|
||||
{% history_plot account.transactions %}
|
||||
{% history_plot account.transactions account=account %}
|
||||
</section>
|
||||
{% endblock body %}
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue