Say I have invoices (parent) and payments (child) and I want to show
each payment made against the invoices while displaying the list of
invoices.

I've read other discussions here about the problems of automatically
loading child records using select_related().

(http://groups.google.com/group/django-users/browse_frm/thread/
53f30fd617f13f1d/18ecb827406d2b8f?
lnk=gst&q=select_related#18ecb827406d2b8f)

I'm assuming the work around involves a separate query for each
Invoice. But I'm not sure how to implement such a thing. (and then
reference it in the template.)

I'm after something that might look like:

{% for i in  invoice %}
   {{i.customer.name}} {{i.invoice.invdate}}
        {% for p in  i.payment %}
              {{p.paymentdate}} {{p.paymentamount}}
        {% endfor %}

{% endfor %}


As always, thanks in advance.

  Lee
--
The reason I prefer groups to IRC is that in groups, I get to thank
you.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to