Fix urls in category plot on month page
This commit is contained in:
parent
574d1d2875
commit
eabdaf2516
2 changed files with 13 additions and 9 deletions
|
@ -6,7 +6,7 @@ register = template.Library()
|
|||
|
||||
|
||||
@register.inclusion_tag("category/category_plot.html")
|
||||
def category_plot(transactions):
|
||||
def category_plot(transactions, **kwargs):
|
||||
categories = (
|
||||
transactions.filter(category__budget=True)
|
||||
.values("category", "category__name", "category__icon")
|
||||
|
@ -17,11 +17,15 @@ def category_plot(transactions):
|
|||
)
|
||||
.order_by("-sum")
|
||||
)
|
||||
return {
|
||||
"categories": categories,
|
||||
} | categories.aggregate(
|
||||
max=Greatest(models.Sum("sum_m"), models.Sum("sum_p")),
|
||||
total_m=models.Sum("sum_m"),
|
||||
total_p=models.Sum("sum_p"),
|
||||
total=models.Sum("value"),
|
||||
return (
|
||||
kwargs
|
||||
| {
|
||||
"categories": categories,
|
||||
}
|
||||
| categories.aggregate(
|
||||
max=Greatest(models.Sum("sum_m"), models.Sum("sum_p")),
|
||||
total_m=models.Sum("sum_m"),
|
||||
total_p=models.Sum("sum_p"),
|
||||
total=models.Sum("value"),
|
||||
)
|
||||
)
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
{{ block.super }}
|
||||
{% if not category %}
|
||||
<h3>{% translate "Categories" %}</h3>
|
||||
{% category_plot transactions %}
|
||||
{% category_plot transactions month=month %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue