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',
> >> )
>> items.aggregate((,), sum=(
>> 'field1',
>> 'field2',
>> ...
>> 'field20',
>> 'field21',
>> ), average=(
>> 'field1',
>> 'field2',
>> ...
>> 'field20',
>> 'field21',
>> ))
>
> well, in this extreme example, I would
On 2/23/07, Tim Chase <[EMAIL PROTECTED]> wrote:
>
> >> quseryset = Model.objects.all()
> >> queryset.aggregate( ( 'name', 'city' ), sum=( 'pay',
> >>> 'some_other_field' ), avg=( 'pay', 'age' ), count=True )
> >> I like this calling interface as an alternate method for its
> >> fine-tuned
>> quseryset = Model.objects.all()
>> queryset.aggregate( ( 'name', 'city' ), sum=( 'pay',
>>> 'some_other_field' ), avg=( 'pay', 'age' ), count=True )
>> I like this calling interface as an alternate method for its
>> fine-tuned control, but there are times it would be nice to not
>> have
On 2/23/07, Tim Chase <[EMAIL PROTECTED]> wrote:
>
> >> I haven't yet figured out a way to suppress the order_by portion,
> >> so what's currently in there is an ugly hack. But it would need
> >> to prevent the standard methods from inserting an ORDER BY clause
> >> against a non-aggregated field.
>> I haven't yet figured out a way to suppress the order_by portion,
>> so what's currently in there is an ugly hack. But it would need
>> to prevent the standard methods from inserting an ORDER BY clause
>> against a non-aggregated field.
>
> if you add an empty call (no parameters) to order_by
On 2/22/07, Tim Chase <[EMAIL PROTECTED]> wrote:
>
> Below I've pasted my first attempt at an aggregate function
> class. Its __init__ takes a queryset (and an optional list of
> aggregate functions to perform if, say, you only want the "sum"s
> rather than min/max/avg/sum). Thus you should be ab
Below I've pasted my first attempt at an aggregate function
class. Its __init__ takes a queryset (and an optional list of
aggregate functions to perform if, say, you only want the "sum"s
rather than min/max/avg/sum). Thus you should be able to do
things like
>>>class Foo(Model):
... blah
8 matches
Mail list logo