Commit 5a3ddb21ac7846cf6b610d974e5c9dce501afbf2

Authored by Carlos Coêlho
1 parent c5c27c5a

Added templatetag to get community related to list

Signed-off-by: Carlos Coelho <carlos@pencillabs.com>
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 @@
  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
... ...