Commit 5a3ddb21ac7846cf6b610d974e5c9dce501afbf2
1 parent
c5c27c5a
Exists in
master
and in
10 other branches
Added templatetag to get community related to list
Signed-off-by: Carlos Coelho <carlos@pencillabs.com>
Showing
2 changed files
with
18 additions
and
0 deletions
Show diff stats
src/colab-spb-plugin/src/colab_spb/templatetags/__init__.py
0 → 100644
src/colab-spb-plugin/src/colab_spb/templatetags/spb_extra.py
0 → 100644
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +from django import template | ||
2 | + | ||
3 | +from colab_spb.models import CommunityAssociations | ||
4 | + | ||
5 | +register = template.Library() | ||
6 | + | ||
7 | +@register.simple_tag | ||
8 | +def get_community(mailinglist): | ||
9 | + ml = mailinglist | ||
10 | + community = "" | ||
11 | + | ||
12 | + try: | ||
13 | + community_association = CommunityAssociations.objects.get(mail_list=ml) | ||
14 | + community = community_association.community | ||
15 | + except CommunityAssociations.DoesNotExist: | ||
16 | + community = "software" | ||
17 | + | ||
18 | + return community |