What you're doing doesn't make any sense at all. You can't access benefits.all()
on the Profile class itself, only on an instance of it. What would Profile.benefits.all()
even mean?
And even if that did work, that would give you a list of Benefits. How could you then use that to exclude Profiles by pk? And then, thirdly, how would that Profile query help you get a list of unused benefits?
If you are trying simply to get a list of Benefits that have no Profiles attached to them, then you actually need to query the Benefits model, not Profile:
unused_benefits = Benefits.objects.filter(profile__isnull=True)