>>> from datetime import timedelta
>>> from django.utils import timezone
>>> one_day_ago = timezone.now() - timedelta(days=1)
>>> posts = Post.objects.filter(published_at__gte=one_day_ago)
>>> Comment.objects.filter(post__in=Subquery(posts.values('pk')))
SELECT ... FROM table WHERE id in (CAST(SELECT id FROM table2) AS uuid);
...
uuid__in=Subquery(queryset, output_field=models.IntegerField())
...