1👍
✅
{% for order in order %}
will not work correctly.
Change your view:
def customer_info(request,pk):
customer = Customer.objects.get(id=pk)
orders = customer.orders_set.all()
context={
'customer': customer,
'orders': orders
}
return render(request,'customer_info.html',context)
And your template:
<table>
<tr>
<td>Name: {{customer.name}}</td>
<td>
Orders:
{% for order in orders %}
{{ order.items.all }}
{% endfor %}
</td>
</tr>
</table>
Source:stackexchange.com