In another thread I wrote the following in regards to how to get the
average for a field:
> Could we educate ourselves on how other frameworks are solving this same
> problem and maybe that will lead us to a solution?

A quick look at ActiveRecord brings up ActiveRecord::Calculations:
http://api.rubyonrails.org/classes/ActiveRecord/Calculations/ClassMethods.html

I kind of like how the more common aggregate calculations are there:
* count
* max
* min
* sum
* average

Django already has: Entry.objects.count()

Could Django also provide these?
* Entry.objects.min('field')
* Entry.objects.max('field')
* Entry.objects.sum('field')
* Entry.objects.average('field')

And a way to group?
* Entry.objects.max('age').group_by('last_name')

And if you do group by it's probably a good idea to add HAVING somehow.

I think for those who need aggregate data these would cover a lot of
ground.  I'd be willing to work on a patch if this is considered
generally useful and we can work out what the API should look like.

-Rob


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to