def METHOD_NAME(qs, _, values):
    if values is not None:
        variants = ProductVariant.objects.filter(
            Q(is_preorder=True)
            & (
                Q(preorder_end_date__isnull=True)
                | Q(preorder_end_date__gte=timezone.now())
            )
        ).values("id")
        lines = OrderLine.objects.filter(
            Exists(variants.filter(id=OuterRef("variant_id")))
        )
        lookup = Exists(lines.filter(order_id=OuterRef("id")))
        qs = qs.filter(lookup) if values is True else qs.exclude(lookup)
    return qs