How to do this using django object query:
SELECT * FROM test WHERE (test_id IN (SELECT test_id FROM test_subject_set)) AND (test_begin_time < \'\') AND (test
Two querysets is 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])