如何使用django-notifications-hq删除通知



我们如何查询和选择通知的特定id。。?

现在我面临的问题是。。。你可以在其他部分看到,我正在发送一个人跟踪另一个人的通知。Now In if选择当一个人取消关注他关注的人时。该通知应该被删除,这样当他再次关注之前的通知时,就会删除并生成新的通知。我期待你们的善意和帮助。谢谢!:(

if follower:
profile_.follower.remove(follower.id)
actor = User.objects.get(pk=user_id)
user = User.objects.get(username=username_to_toggle)
query = Notification.objects.filter(id__in=notificacion_ids).update(deleted=True) #notificacion_ids(I don't understand how to get that.)
print(query,"hey heyh eh")
# json_follower = some_view(user)
else:
new_follower = User.objects.get(username__iexact=username_to_toggle)
profile_.follower.add(new_follower.id)
actor = User.objects.get(pk=user_id)
user = User.objects.get(username=username_to_toggle)
notify.send(actor, recipient=user, verb='follow you')
# json_follower = some_view(username_to_toggle)
is_following = True  

然后使用"actor"one_answers"receiver"过滤通知模型。类似这样的东西:

notification_ids =Notification.objects.filter(actor_object_id=actor.id,recipient_id=user.id).values_list('id', flat=True)

最新更新