On vr, 2010-07-02 at 16:10 -0700, eka (Esteban) wrote:
> I have an Entry model with a FK to User, what I want is to get a list
> of Users ordered by its Entry quantity. Can I achieve that using
> QuerySets?
queryset.annotate(Count('entry')).order_by('entry__count')
See http://docs.djangoproject.com/en/dev/topics/db/aggregation/
--
Dennis K.
They've gone to plaid!
--
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.