Hi Dirk,
On Sat, 2007-02-10 at 12:02 +0100, Dirk Eschler wrote:
> Hello,
>
> i'm trying to get a dict of emails with usernames as keys.
>
> User.objects.filter(username__in=['foo', 'bar']).values('username', 'email')
>
> The above returns a list of dicts:
> [{'username': 'foo', 'email': '[EMAIL PROTECTED]'},
> {'username': 'bar', 'email': '[EMAIL PROTECTED]'}]
>
> Is it possible to get a dict like this with Django's db api?:
> {'foo':'[EMAIL PROTECTED]', 'bar':'[EMAIL PROTECTED]'}
No, it is not possible to get that sort of dictionary back directly from
Django.
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---