I have Django query with sub-query like this
cust_order = TOrder.objects \
.select_related('user') \
.annotate(category_name=Subquery(TOrderDetail.objects
.filter(t_order=OuterRef('id'),
deleted_at__isnull=True,
deleted_by__isnull=True)
.values_list('product__product_category__name', flat=True)[:1])
cust_feedback=Subquery(TOrderFeedback.objects
.filter(t_order=OuterRef('id'),
deleted_at__isnull=True,
deleted_by__isnull=True,
.values_list('message', flat=True)[:1]),
The problem is, some times the sub-query of cust_feedback will empty, and how can I do filter if the cust_feedback is empty then the parent query should return nothing ?
Thanks