Beispiel #1
0
    def delete_notifications_for_user(self, user):
        # Remove all post comment notifications
        PostCommentNotification = get_post_comment_notification_model()
        PostCommentNotification.objects.filter(post_comment__post_id=self.pk,
                                               notification__owner_id=user.pk).delete()

        # Remove all post reaction notifications
        PostReactionNotification = get_post_reaction_notification_model()
        PostReactionNotification.objects.filter(post_reaction__post_id=self.pk,
                                                notification__owner_id=user.pk).delete()

        # Remove all post comment reply notifications
        PostCommentReplyNotification = get_post_comment_notification_model()
        PostCommentReplyNotification.objects.filter(post_comment__post=self.pk,
                                                    notification__owner_id=user.pk).delete()
Beispiel #2
0
    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()