Exemplo n.º 1
0
    def _q_lookup(self, request, part):
        from models.team_group import TeamGroup

        team = self.team
        group = TeamGroup.get(team_id=team.id, name=part)
        if not group:
            raise TraversalError
        return TeamGroupUI(group)
Exemplo n.º 2
0
    def _q_index(self, request):
        from models.team_group import TeamGroup

        context = {}
        team = self.team
        context["request"] = request
        context["team"] = team
        context["user"] = request.user
        if request.method == "POST":
            user = request.user
            name = request.get_form_var("group[name]")
            desc = request.get_form_var("group[description]", "")
            perm = request.get_form_var("group[permission]", "pull")
            g = team.create_group(
                name=name, creator_id=user.name, description=desc, permission=TeamGroup.translate_perm(perm)
            )
            return request.redirect(self.team.url + "groups/%s" % g.name)
        groups = TeamGroup.gets_by(team_id=team.id)
        context["groups"] = groups
        return st("/teams/groups.html", **context)
Exemplo n.º 3
0
 def groups(self):
     from models.team_group import TeamGroup
     return TeamGroup.gets(team_id=self.id)
Exemplo n.º 4
0
 def create_group(self, **kw):
     from models.team_group import TeamGroup
     kw['team_id'] = self.id
     t = TeamGroup.create(**kw)
     return t