revert _
This commit is contained in:
adrien-lsh
2024-04-19 06:43:12 +00:00
parent 6b82f00a14
commit 9bc3092a0e
5 changed files with 74 additions and 13 deletions

View File

@ -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)