This is probably a duplicate as I recall seeing a similar issue, but I couldn't find it, so here it goes:

We have 2 models (lets say, Company and Person), connected thru a M2M table (Membership) with additional attribute "active".

The following queries work as documented:

base = Company.objects.all()
# 1) select all companies in which person 1 is active
base.filter(membership_set__active=True, membership_set__person=1)
# 2) select all companies in which some membership is active or person '1' is a member
base.filter(membership_set__active=True).filter(membership_set__person=1)