1👍
✅
Did you try this?
Subject.objects.filter(question__id__isnull=False).distinct()
You might even be able to simplify it to the following, but I’m too lazy to look up if it’s correct or try it out:
Subject.objects.filter(question__isnull=False).distinct()
Source:stackexchange.com