File diff 6e67b505013b → 40f4d1bb8d07
symposion/teams/templatetags/teams_tags.py
Show inline comments
...
 
@@ -13,25 +13,24 @@ class AvailableTeamsNode(template.Node):
 
        if len(bits) == 3 and bits[1] == "as":
 
            return cls(bits[2])
 
        else:
 
            raise template.TemplateSyntaxError("%r takes 'as var'" % bits[0])
 
    
 
    def __init__(self, context_var):
 
        self.context_var = context_var
 
    
 
    def render(self, context):
 
        request = context["request"]
 
        teams = []
 
        for team in Team.objects.all():
 
            print team
 
            state = team.get_state_for_user(request.user)
 
            if team.access == "open":
 
                if state in [None, "invited"]:
 
                    teams.append(team)
 
            elif team.access == "application":
 
                if state in [None, "invited", "applied"]:
 
                    teams.append(team)
 
            elif team.access == "invitation":
 
                if state == "invited":
 
                    teams.append(team)
 
        context[self.context_var] = teams
 
        return u""