That example was just showing the part of the values 'grab' that was a
problem; in real life I'm getting data from Recipient as well.

On Sun, Jan 4, 2015 at 11:50 AM, Collin Anderson <[email protected]>
wrote:

> Hi,
>
> Why not query it directly from Message?
>
> Message.objects.filter(recipient__user__system_id=user_id).values('id',
> 'subject')
>
> Collin
>
> On Friday, January 2, 2015 8:35:42 PM UTC-5, Lee Hinde wrote:
>>
>> If I do a query:
>>
>> messages = Recipient.objects.filter(user__system_id=user_id).values("
>> message__id","message__subject")
>>
>> and then
>>
>> {"data":list(messages)}
>>
>> jsonify it, I end up with:
>>
>>   "data" : [
>>     {
>>       "message__id" : "2f24d132-4321-4d63-868a-21de6fbc0d44",
>>       "message__subject" : "And look, a new subject."
>>     }
>>   ],
>>
>> Let's assume there are lots of messages.
>>
>> What's the best way rename the keys? I.e, I'd like "message__id" to be
>> "id".
>>
>>
>>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMxqo9gd_6HiUM8wuZmGs2FSOdyJn3qRUUfuvmTgTDuYmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to