@@ -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"]:
elif team.access == "invitation":
if state == "invited":
context[self.context_var] = teams
return u""