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")
|
@register.inclusion_tag("category/category_plot.html")
|
||||||
def category_plot(transactions):
|
def category_plot(transactions, **kwargs):
|
||||||
categories = (
|
categories = (
|
||||||
transactions.filter(category__budget=True)
|
transactions.filter(category__budget=True)
|
||||||
.values("category", "category__name", "category__icon")
|
.values("category", "category__name", "category__icon")
|
||||||
|
@ -17,11 +17,15 @@ def category_plot(transactions):
|
||||||
)
|
)
|
||||||
.order_by("-sum")
|
.order_by("-sum")
|
||||||
)
|
)
|
||||||
return {
|
return (
|
||||||
|
kwargs
|
||||||
|
| {
|
||||||
"categories": categories,
|
"categories": categories,
|
||||||
} | categories.aggregate(
|
}
|
||||||
|
| categories.aggregate(
|
||||||
max=Greatest(models.Sum("sum_m"), models.Sum("sum_p")),
|
max=Greatest(models.Sum("sum_m"), models.Sum("sum_p")),
|
||||||
total_m=models.Sum("sum_m"),
|
total_m=models.Sum("sum_m"),
|
||||||
total_p=models.Sum("sum_p"),
|
total_p=models.Sum("sum_p"),
|
||||||
total=models.Sum("value"),
|
total=models.Sum("value"),
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% if not category %}
|
{% if not category %}
|
||||||
<h3>{% translate "Categories" %}</h3>
|
<h3>{% translate "Categories" %}</h3>
|
||||||
{% category_plot transactions %}
|
{% category_plot transactions month=month %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue