my view to display friendlist:
def friend_list(request): context = { 'results_from_user': Friend.objects.filter(from_user=request.user), 'results_to_user': Friend.to_user } return render(request, 'friend/friend_list.html', context) my template: {% for result in results_from_user %} {% if result.from_user == result.to_user %} <tr>{{pass}}</tr> {% endif %} <tr> <td> <img src="{{ result.from_user.profile.image.url }}" class="rounded-circle account-img"/> </td> <td> <ul> <li> <a href="{% url 'profile' result.from_user.id %}">{{result.from_user.first_name}} {{result.from_user.last_name }}</a> </li> </ul> </td> It displays name of the logged in user with profile picture in a tabular format. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/93780763-f241-44c7-ac71-83d898c842ef%40googlegroups.com.