I want to aggregate amount of item for each day separately.
Model:
class Bill(models.Model):
date = models.DateTimeField()
amount = models.IntegerField(null=False, blank=False)
Template:
{% with var=bill.date|date:"Y-m-d" %}
{{ var }} #dict?
{% endwith %}
I think, that add date to dictionary as a key, and count amount of item as a value is a good idea, so I write it:
Dict[var] += bill.amount
How can I use it in Django template?
Am I on the right way? Maybe other solution are better?