class NotificationSerializer(serializers.ModelSerializer): creator = user_serializers.ListUserSerializer() image = image_serializers.SmallImageSerializer() class Meta: model = models.Notification fields = '__all__'
def post(self, request, image_id, format=None): likes = models.Like.objects.filter(image__id=image_id) like_creators_ids = likes.values('creator_id') users = user_models.User.objects.filter(id__in=like_creators_ids) serializer = user_serializers.ListUserSerializer(users, many=True) return Response(data=serializer.data, status=status.HTTP_200_OK)