Ok here is the code of my view.
def customers_to_be_called(request):
customers = Customer.objects.filter(call=True)
list_of_customers = []
for cust in customers:
jobs = Job.objects.filter(customer = cust)
customer_date = {}
customer_data['customer'] = cust
customer_date['jobs'] = jobs
list_of_customers.append(customer_data)
return render(request, 'repairs/customers_to_be_called.html',
{'list_of_customers' : list_of_customers,
})
and here is the template that is gonna be rendered
<div>
{% for customer in list_of_customers %}
<h2> {{customer['customer'].name}} </h2>
<ul>
{% for job in customer['jobs'] %}
<li> {{job.product}} </li>
{% endfor %}
</ul>
{% endfor %}
</div>
But When I send a request to this page I get the following error.
I don't know why it isn't parsing customer in the template while there is data in it..??