This is a feature request that didn't make it into 1.7: 
https://code.djangoproject.com/ticket/16735 



From: "Lee Hinde" <leehi...@gmail.com> 
To: django-users@googlegroups.com 
Sent: Friday, January 2, 2015 7:34:59 PM 
Subject: Change keys in values dictionary. 

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/CA%2BePoMwXBvBC2tLTY1mCWyNcJgYe6v1ybpRd16qhRYwJ8Ta%2Bcg%40mail.gmail.com
 . 
For more options, visit https://groups.google.com/d/optout . 

-- 
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/1636154369.364132.1420302659321.JavaMail.zimbra%40cybernetik.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to