diff --git a/openstates/data/models/people_orgs.py b/openstates/data/models/people_orgs.py index b5825d51f..e8bfcc811 100644 --- a/openstates/data/models/people_orgs.py +++ b/openstates/data/models/people_orgs.py @@ -117,7 +117,7 @@ def __str__(self): class PersonQuerySet(QuerySet): - def member_of(self, organization_name, current_only=True, post=None): + def member_of(self, organization_name, current_only=True, post=None, division_id=None): if organization_name.startswith("ocd-organization/"): org_filter = Q(memberships__organization_id=organization_name) else: @@ -132,6 +132,8 @@ def member_of(self, organization_name, current_only=True, post=None): ) & Q(memberships__end_date="") | Q(memberships__end_date__gte=today) if post: org_filter &= Q(memberships__post__label=post) + if division_id: + org_filter &= Q(memberships__post__division_id=division_id) return qs.filter(org_filter).distinct() def active(self):