[Django]-Exclude on a many-to-many relationship through a third table

4👍

Maybe this? (untested)

Person.objects.exclude(id__in=Person.objects.filter(project=p, status__is_red=True).values(id))

0👍

If you have a list of Status objects called ‘objects’, you can use

[s.person for s in objects]

to make it into a list of the corresponding Persons.

Leave a comment