Thank you, it solved this problem :)

Now, I've encountered another issue, which you can see below. When
using only single item in annotation it works, but when using two, it
returns the same result.
I've added default ordering in all of my models, and as you can se,
I've tried including it directly, with no success.

>>> Event.objects.all().annotate(c=Count('comments'))[0].c
1
>>> Event.objects.all().annotate(p=Count('participants'))[0].p
2
>>> Event.objects.all().annotate(c=Count('comments'), 
>>> p=Count('participants'))[0].c
2
>>> Event.objects.all().annotate(c=Count('comments'), 
>>> p=Count('participants'))[0].p
2
>>> Event.objects.all().annotate(c=Count('comments'), 
>>> p=Count('participants')).order_by('-c', 'p')[0].p
2
>>> Event.objects.all().annotate(c=Count('comments'), 
>>> p=Count('participants')).order_by('-c', 'p')[0].c
2

Thank you for you help.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to