1👍
You could try itertools.groupby
, but careful as Django might cache the generator as a list and consume it.
from itertools import groupby
groupby(orders, lambda order : order.date.month)
👤C.B.
Source:stackexchange.com
1👍
You could try itertools.groupby
, but careful as Django might cache the generator as a list and consume it.
from itertools import groupby
groupby(orders, lambda order : order.date.month)