diff --git a/akvo/rsr/models.py b/akvo/rsr/models.py index 659d407e1f..3763da6444 100644 --- a/akvo/rsr/models.py +++ b/akvo/rsr/models.py @@ -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) diff --git a/akvo/rsr/views.py b/akvo/rsr/views.py index ad8d75685f..a900e0da0a 100644 --- a/akvo/rsr/views.py +++ b/akvo/rsr/views.py @@ -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':