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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/4d75e1df-0a33-4762-864c-ec1d0e4af7fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to