So just for completeness, here is the bit about avoiding the inner for loop in this situation:
On Jan 17, 8:40 am, ptone <pres...@ptone.com> wrote: > matching_torrents = Torrent.objects.filter(name__icontains='x360') > my_data = [] > for a_torrent in matching_torrents: > info_objects = a_torrent.torrentInfo_set.all() > seeds = [] > for a_info in info_objects: > seeds.append(a_info.seed) > my_data.append((a_torrent.name,seeds)) > http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-fields my_data = [] for a_torrent in matching_torrents: torrent_info = a_torrent.torrentInfo_set.values ('seeds','leeches') my_data.append((a_torrent.name, torrent_info)) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---