Thursday, October 2, 2014

Re: transpose values_list result from ORM

Assuming "klist" is a typo, your setdefault code _should_ give you something close to what you want, though not exactly in a table. What happens when you try? 

I simplified your code slightly:
data = {}
for kz in kzlist:  # assuming klist was a typo
    data
.setdefault(kz['date'], {})[kz['key']] = kz['value']  # slightly simpler

How are you displaying the information?

--
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+unsubscribe@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/888363d2-30a6-4a53-8241-d5d07ad40ff0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment