Skip to content

Commit

Permalink
[#204] Update support partner list
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Jun 13, 2014
1 parent c48eced commit ade9b91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions akvo/rsr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,15 @@ def sponsorpartners(self):
def supportpartners(self):
return self.partners(Partnership.SUPPORT_PARTNER)

def supportpartners_with_projects(self):
"""return the organisations in the queryset that are support partners with published projects, not
counting archived projects"""
support_partners = self.supportpartners()
for org in support_partners:
if len(org.active_projects()) == 0:
support_partners = support_partners.exclude(pk=org.pk)
return support_partners

def ngos(self):
return self.filter(organisation_type__exact=Organisation.ORG_TYPE_NGO)

Expand Down
2 changes: 1 addition & 1 deletion akvo/rsr/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def orglist(request, org_type='all'):
if org_type == 'field':
orgs = orgs.fieldpartners()
elif org_type == 'support':
orgs = orgs.supportpartners()
orgs = orgs.supportpartners_with_projects()
elif org_type == 'funding':
orgs = orgs.fundingpartners()
elif org_type == 'sponsor':
Expand Down

0 comments on commit ade9b91

Please sign in to comment.