On Thu, Jun 12, 2008 at 8:21 PM, Knifa <[EMAIL PROTECTED]> wrote:
>
> Hay there.
>
> Is it possible to sort by the number of related models another single
> model has?
>
> I'm trying to make a quote database, where there are Quotes with many
> Votes related to them. I want to be able to get all of the Quote
> objects, and sort them by the number of Votes they have. I'm unsure
> how I'd do it with Django or if I'd need to do the sorting myself.

Right now - no. Django doesn't currenlty have built-in support for
aggregates. There are some workarounds you can use, but they're not
simple.

However, this will change soon. There is a Google Summer of Code
project that is implementing aggregates. It is still in development,
but you can use the code now if you want:

http://code.google.com/p/django-aggregation

I know Nicolas would welcome any feedback you can offer.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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