I have a view that returns my sales summary grouped by sales_date e.g.
[{'sale_date':datetime.datetime(2010,10,5,0,0), 'salesum':2, 'item':1},
{'sale_date':datetime.datetime(2010,10,5,0,0), 'salesum':10,'item':3},
{'sale_date':datetime.datetime(2010,10,6,0,0), 'salesum':1, 'item':1}]
I have done the grouping inside the template, and combined it with html ul and li tags to give me a nice grouping effect based on the sale_date
My template grouping is based on this code:
{% regroup salecursor by sale_date|date:"j/m/Y" as salelist %}
and
{{ saleitem.grouper }
The result is:
05/10/2010
- item1 Name - 2
- item2 Name - 10
06/10/2010
- Item1 Name - 1
How do u get a running total for each group i.e. group one should have a total of 12 and the second group a total of 1 and have something of this effect;
05/10/2010
- item1 Name - 2
item2 Name - 10
Total 12
06/10/2010
Item1 Name - 1
Total 1
Thanks Gath