From 289f4b8d3f6b46dacd9308ac5e8f7f99f1ea668f Mon Sep 17 00:00:00 2001 From: Kasper Brandt Date: Tue, 17 Jun 2014 13:38:54 +0200 Subject: [PATCH] [#204] Updated support partner list query --- akvo/rsr/models.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/akvo/rsr/models.py b/akvo/rsr/models.py index 3763da6444..c9d86530c7 100644 --- a/akvo/rsr/models.py +++ b/akvo/rsr/models.py @@ -401,11 +401,9 @@ def supportpartners(self): 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 + return self.filter(partnerships__partner_type=Partnership.SUPPORT_PARTNER, + partnerships__project__publishingstatus__status='published', + partnerships__project__status__in=['A','C','H','L']).distinct() def ngos(self): return self.filter(organisation_type__exact=Organisation.ORG_TYPE_NGO)