def create_post_user_mention(cls, user, post): post_user_mention = cls.objects.create(user=user, post=post) PostUserMentionNotification = get_post_user_mention_notification_model() PostUserMentionNotification.create_post_user_mention_notification(post_user_mention_id=post_user_mention.pk, owner_id=user.pk) send_post_user_mention_push_notification(post_user_mention=post_user_mention) return post_user_mention
def delete_notifications(self): # Remove all post comment notifications PostCommentNotification = get_post_comment_notification_model() PostCommentNotification.objects.filter(post_comment__post_id=self.pk).delete() # Remove all post reaction notifications PostReactionNotification = get_post_reaction_notification_model() PostReactionNotification.objects.filter(post_reaction__post_id=self.pk).delete() # Remove all post comment reply notifications PostCommentReplyNotification = get_post_comment_notification_model() PostCommentReplyNotification.objects.filter(post_comment__post_id=self.pk).delete() # Remove all post user mention notifications PostUserMentionNotification = get_post_user_mention_notification_model() PostUserMentionNotification.objects.filter(post_user_mention__post_id=self.pk).delete()