profiles: friend requests
This commit is contained in:
@ -44,7 +44,7 @@ class ProfileModel(Model):
|
||||
).delete()
|
||||
|
||||
def is_friend_requested_by(self, profile):
|
||||
return self.get_received_friend_request_from(profile) is None
|
||||
return FriendRequestModel.objects.filter(author=profile, target=self).exists()
|
||||
|
||||
def get_received_friend_request_from(self, profile):
|
||||
return FriendRequestModel.objects.filter(author=profile, target=self).first()
|
||||
@ -52,10 +52,13 @@ class ProfileModel(Model):
|
||||
def is_friend_requesting(self, profile):
|
||||
return FriendRequestModel.objects.filter(author=self, target=profile).exists()
|
||||
|
||||
def get_sent_friend_requests(self) -> list[ProfileModel]:
|
||||
def get_outgoing_friend_request_to(self, profile):
|
||||
return FriendRequestModel.objects.filter(author=self, target=profile).first()
|
||||
|
||||
def get_outgoing_friend_requests(self) -> list[ProfileModel]:
|
||||
return FriendRequestModel.objects.filter(author=self)
|
||||
|
||||
def get_received_friend_requests(self) -> list[ProfileModel]:
|
||||
def get_incoming_friend_requests(self) -> list[ProfileModel]:
|
||||
return FriendRequestModel.objects.filter(target=self)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user