Hi, I'm trying to get sum for all/most fields in a rather large class.
I'd like to avoid having to list every single fields manually. I found this in a different thread : (http://groups.google.ie/group/ django-users/browse_thread/thread/fc58fbe409a6f098/1110c688e1af58d2? hl=en&lnk=gst&q=aggregate+multiple+field#1110c688e1af58d2) >well, in this extreme example, I would suggest you use a list: >fields = [ f.name for f in items.model._meta.fields ] >items.aggregate( sum=fields, average=fields, min=fields, max=fields ) Looks about exactly what I need, but I simply can't get it to work. I got the list after dropping the ".model." part ( fields = [f.name for f in items._meta.fields] ) it's the aggregate statement I can't get to work. I'm using Django 1.1 and the documentation for the aggregate function doesn't describe the same syntax as above. Am I missing something, or is the example above (or something equivalent) just too good to be true? Regards, Dids, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---