Re: values_list of ordered annotated QuerySet

2011-03-22 Thread Andreas Pfrengle
Thank you, it works! :-) -- 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 optio

Re: values_list of ordered annotated QuerySet

2011-03-22 Thread Marcos Moyano
This should work without grabbing the entire table: [x[0] for x in Wizard.objects.filter(**filterargs).annotate(wpower=Sum('creatures__power')).order_by('- wpower').values_list('id', 'wpower')] Rgds, Marcos On Tue, Mar 22, 2011 at 5:25 PM, Andreas Pfrengle wrote: > just pulling it up again... >

Re: values_list of ordered annotated QuerySet

2011-03-22 Thread Andreas Pfrengle
just pulling it up again... -- 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 op

values_list of ordered annotated QuerySet

2011-03-18 Thread Andreas Pfrengle
Hello, I want to annotate a Queryset, order it by the annotated field and then return a simple (ordered) values_list of the ids of the objects: Wizard.objects.filter(**filterargs).annotate(wpower=Sum('creatures__power')).order_by('- wpower').values_list('id', flat=True) The 'Creature'-Model has