Commit 029b624bad8f093d700ece25bfb47206dc468b5d
Committed by
Luciano Prestes
1 parent
d7936151
Exists in
master
and in
51 other branches
Refactoring search association from community
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
src/colab-spb-plugin/src/colab_spb/views.py
... | ... | @@ -71,12 +71,12 @@ def get_community_association(community, limit=7, offset=0): |
71 | 71 | if not community: |
72 | 72 | return {} |
73 | 73 | |
74 | - associations = CommunityAssociations.objects.all() | |
75 | - for community_association in associations: | |
76 | - if community_association.community.identifier in community: | |
77 | - return {'community': community_association.community.identifier, | |
78 | - 'repository': community_association.group.url, | |
79 | - 'mailman_list': community_association.mail_list.name, | |
74 | + association = CommunityAssociations.objects.filter( | |
75 | + community__identifier=community).first() | |
76 | + if association: | |
77 | + return {'community': association.community.identifier, | |
78 | + 'repository': association.group.url, | |
79 | + 'mailman_list': association.mail_list.name, | |
80 | 80 | 'limit': limit, |
81 | 81 | 'offset': offset} |
82 | 82 | return {} | ... | ... |