On Thu, Jul 2, 2009 at 15:55, The Danny Bos <danny...@gmail.com> wrote:
> Just having trouble getting the Author loop from within my Review > set. > Here's what I have below, I figured this was pretty close but I'm > wrong aren't I? Does it give you any errors? > {% for review in reviews_full %} > <a href="">{{ review.item.title }}</a><br/> > {{ review.item.publisher.name }}<br/> > > {% for author in review.item.author_set.all %} > {{ author.name }}, > {% endfor %} > > {{ review.pream }} > {% endfor %} > > Any ideas would be great. > Hope the above makes some sense ... This looks good. You could use django-debug-toolbar [1] for example, to check how many queries that generated. [1] http://github.com/robhudson/django-debug-toolbar/tree/master > On Jul 2, 10:22 pm, Alex Robbins <alexander.j.robb...@gmail.com> > wrote: > > You should take a look at select_related[1]. It will take the lot of > > queries TiNo was talking about and flatten it down to one big one. > However, select_related only follows ForeignKeys, not the Authors ManyToMany relationship. TiNo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---