def get_total_price(cls, year, month): total_price = cls.objects.filter(created_at__year=year, created_at__month=month).aggregate(total=Coalesce(Sum('price'), 0)) return total_price['total']