From 029b624bad8f093d700ece25bfb47206dc468b5d Mon Sep 17 00:00:00 2001 From: Macartur Sousa Date: Thu, 29 Oct 2015 13:46:10 -0200 Subject: [PATCH] Refactoring search association from community --- src/colab-spb-plugin/src/colab_spb/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/colab-spb-plugin/src/colab_spb/views.py b/src/colab-spb-plugin/src/colab_spb/views.py index e398302..b4606ca 100644 --- a/src/colab-spb-plugin/src/colab_spb/views.py +++ b/src/colab-spb-plugin/src/colab_spb/views.py @@ -71,12 +71,12 @@ def get_community_association(community, limit=7, offset=0): if not community: return {} - associations = CommunityAssociations.objects.all() - for community_association in associations: - if community_association.community.identifier in community: - return {'community': community_association.community.identifier, - 'repository': community_association.group.url, - 'mailman_list': community_association.mail_list.name, + association = CommunityAssociations.objects.filter( + community__identifier=community).first() + if association: + return {'community': association.community.identifier, + 'repository': association.group.url, + 'mailman_list': association.mail_list.name, 'limit': limit, 'offset': offset} return {} -- libgit2 0.21.2