1👍
✅
Leave the view as is and change the template to:
{% for profile in users %}
<tr>
<td>{{ profile.user.username }}</td>
<td>{{ profile.customer_linked.name }}</td>
</tr>
{% endfor %}
Side note: to increase speed and reduce the number of DB hits use the select_related()
method:
users = UserProfile.objects.select_related().filter(is_agency=True)
Source:stackexchange.com