On Sun, Jul 24, 2011 at 3:10 AM, Gelonida N <gelon...@gmail.com> wrote:
> Hi, > > I try to populate a template from a Model with a ForeignKey element) > members of the foreign key element should be displayed. > > If I understand correctly my first attempt resulted in one query for > fetching the entries from my first model and in one Query for each row > in order to look up the contents related to the foreign key. > Hi, you can use select_related in order to prefetch related data. https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related -- Marc -- 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.