Commit 2308a5505c27f3bfee61d60f64fd9ec259c84a4d
Committed by
Alexandre Barbosa
1 parent
88c55e2a
Exists in
master
and in
66 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,12 +71,12 @@ def get_community_association(community, limit=7, offset=0): | ||
71 | if not community: | 71 | if not community: |
72 | return {} | 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 | 'limit': limit, | 80 | 'limit': limit, |
81 | 'offset': offset} | 81 | 'offset': offset} |
82 | return {} | 82 | return {} |