def notify(self): # Notify recipient un = UserNotifications(self.recipient) un.add_friend_request(self) # Send email notify_friend_request(self.sender, self.recipient)
def accept(self): # Add friend to symmetric relation self.sender.friends.add(self.recipient) # Notify sender un = UserNotifications(self.sender) un.add_friend_request(self, accepted=True) # Send email notify_friend_request(self.sender, self.recipient, accepted=True) # Delete self.delete()