I created a ticket for this: http://code.djangoproject.com/ticket/3566
any comments are welcome On 2/23/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > >> items.aggregate((,), sum=( > >> 'field1', > >> 'field2', > >> ... > >> 'field20', > >> 'field21', > >> ), average=( > >> 'field1', > >> 'field2', > >> ... > >> 'field20', > >> 'field21', > >> )) > > > > 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 ) > > > > not that bad, is it? > > A nice way to do this, and a good compromise on a clean syntax that is > also easy to do what I need. > > > true, but only if you would want to aggregate by those fields, we > > could work around that by simply moving the grouping fields to a > > separate dictionary as well: > > > > [ > > { > > 'grouped_by' : { 'owner' : XX }, > > 'min' : { 'pay' : 100 }, > > 'max' : { 'pay' : 101}, > > }, > > ..... > > ] > > Another excellent idea. Pleasantly simple yet a good way to encapsulate > the info while still removing the ambiguity of field-names that conflict > with aggregate-function names. I'm still mildly concerned about being > able to access the contents from within a template, wherein one could > access it by member notation suggested earlier: > > stats.grouped_by.owner > stats.sum.pay > stats.max.pay > > -tkc > > > > > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---