def logIndex(request):
matches = []
for log in Log.objects.all()[:50]:
try:
customer = Customer.objects.get(lp=log.lp)
matches.append(customer)
except Customer.DoesNotExist:
customer= None
print matches
return render_to_response('Logs.html',{'logs':Log.objects.all()[:50],
'matches':matches,})
<tbody>
{%for log in logs %}
{%for match in matches%}
{% if match.lp == log.lp%}
<tr>
<th>{{log.cam}}</th>
<th>{{log.log_date}}</th>
<th>{{log.status}}</th>
<th>{{match.first_name}}</th>
<th>{{match.last_name}}</th>
<th><a href="/customers/{{match.lp}}" > {{match.lp}}</a></th>
</tr>
{%else%}
<tr>
<th>{{log.cam}}</th>
<th>{{log.log_date}}</th>
<th>{{log.status}}</th>
<th></th>
<th></th>
<th>{{log.lp}}</th>
</tr>
{% endif %}
{%endfor%}
{%endfor%}
</tbody>
но печально то, что сам мог до такого додуматься...
Спасибо Огромное!