On 8/3/06, Daniel Poelzleithner <[EMAIL PROTECTED]> wrote:
> >>> NetworkState.objects.all().order_by("-stopdate")[:5].values("id")
> [{'id': 2738}, {'id': 2737}, {'id': 2736}, {'id': 2735}, {'id': 2734}]
>
> Then i have to unpack it to get a [2738, 2737,...] list, which is what I
> wanted in the first place.
>
> I suggest Object.objects.all().values("id", flat=True). Flat as a
> optional argument, which is only allowed when only one field is
> requested and returns a list with only the values.

Oooh, that's a nice idea. I'm not 100% certain "flat=True" is the best
name for it, but I can't think of anything better at the moment. Would
you be willing to submit a patch?

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to