Hi Dalore, Thanks for that. I changed it a bit because it was still within that {% for sale in sales %} loop. It works. But it really makes the raw html pretty ugly with loads of spaces in it. Never mind. I suppose no- one is going to see it.
{% for rate in rates %} <tr> <th class="centered">{{ rate.cost_item.name }}</th> {% for appointment in appointments %} <td class="centered"> <input type="text" name="sales_{{rate.id}} _{{ appointment.id }}" {% for sale in sales %} {% if sale.appointment.id == appointment.id and rate.cost_item.id == sale.cost_rate.cost_item.id %} value="{{sale.units}}" {% endif %} {% endfor %} size="4" maxlength="4" style="text-align:center" /> </td> {% endfor %} </tr> {% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.