陈亮 wrote:
Hi there,I've googled a lot on how to get the sum of a integer field for all the objects of a model. There are some solutions. But none of them looks like a standard way to do so. Does django have this feature?
I use: total = sum([obj.amount for obj in Model.objects.all()]) I'd imagine some custom SQL would be more efficient, but it works. Cheers -D
signature.asc
Description: OpenPGP digital signature