revsys/django-friendship

Trying to get sent friend requests.

ashmlk opened this issue · 2 comments

Hi I am trying to get the list of users who the user has sent a friend request to, however, when using Friend.objects.sent_requests(user=request.user) this only print's the id of the user and not users who have received a friend request. How can I get a list of users who the user has sent a friend request?

Try fr.to_user_id for fr in Friend.objects.sent_requests(user=user).

if you want a list of usernames from outgoing friend requests:
[fr.to_user.username for fr in Friend.objects.sent_requests(user=request.user)]

if you want a list of user objects from outgoing friend requests:
[fr.to_user for fr in Friend.objects.sent_requests(user=request.user)]