Two querysets are documented way of doing this. It will be one database hit anyway.
test_ids = Subject.objects.all()
result = Test.objects.filter(test_id__in=test_ids).filter([some other filtering])
Two querysets are documented way of doing this. It will be one database hit anyway.
test_ids = Subject.objects.all()
result = Test.objects.filter(test_id__in=test_ids).filter([some other filtering])