I want to send a notification to users who have previously commented on the request. Therefore, for this purpose, I must find individual users and exclude the identifier of the current user (user) from this list.
object_id_list = ScAns.objects.filter(username=username).values_list('id',flat=True)
result-> QuerySet [22]
actionUsers = ScAnsAction.objects.filter(req_id=request_id).values_list('user_id',flat=True).distinct().exclude(id__in=object_id_list)
result-> QuerySet [13, 15, 22]
final The result should not contain 22. It should give [13,15]
source
share