or:

{ o.pk: o for o in Model.objecs.all() }



On Thursday, August 4, 2011 at 4:12:31 PM UTC-4, Javier Guerra Giraldez 
wrote:
>
> On Thu, Aug 4, 2011 at 2:19 PM, diafygi <[email protected] <javascript:>> 
> wrote:
> > Is there a built in way to get:
> >>>Model.objects.all().something_pk_values()
> > {1 : {'vin':189554}, 2 : {'vin':189555}}
>
>
> built in to Python:
>
> dict ((o.pk, o) for o in Model.objecs.all())
>
> -- 
> Javier
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1af92a54-2a55-48e4-9cf7-3de3c073d4fd%40googlegroups.com.

Reply via email to