示例#1
0
文件: team.py 项目: thomaserlang/TLog
    def post(self, team_id):
        '''
        Validates and updates the team.
        Redirects to the new team if successful.

        :param team_id: int
        '''
        team = Team.get(id_=team_id)
        if not team:
            self.error(404, 'Team not found')
        form = forms.Team(self.request.arguments)
        if form.validate():
            Team.update(
                id_=team_id,
                name=form.name.data,
            )
            self.redirect('/team/{}'.format(team.id))
            return
        self.render(
            'team.html',
            title='New team',
            form=form,
            edit=True,
            users=Users.get(),
            team=team,
            members=Users_team.get(team_id=team_id),
        )
示例#2
0
文件: team.py 项目: thomaserlang/TLog
    def post(self, team_id):
        '''
        Validates and updates the team.
        Redirects to the new team if successful.

        :param team_id: int
        '''
        team = Team.get(id_=team_id)
        if not team:
            self.error(404, 'Team not found')
        form = forms.Team(self.request.arguments)
        if form.validate():
            Team.update(
                id_=team_id,
                name=form.name.data, 
            )
            self.redirect('/team/{}'.format(team.id))
            return
        self.render(
            'team.html',
            title='New team',
            form=form,
            edit=True,
            users=Users.get(),
            team=team,
            members=Users_team.get(team_id=team_id),
        )
示例#3
0
 def test_update(self):
     team = self.new_team()
     Team.update(
         id_=team.id,
         name='Test 2'
     )
     team = Team.get(id_=team.id)
     self.assertEqual(team.name, u'Test 2')
示例#4
0
文件: team.py 项目: thomaserlang/TLog
    def get(self, team_id):
        '''
        Renders the edit team form. 

        :param team_id: int
        '''
        team = Team.get(id_=team_id)
        if not team:
            self.error(404, 'Team not found')
        form = forms.Team()
        form.name.data = team.name
        self.render(
            'team.html',
            title=u'Team: {}'.format(team.name),
            form=form,
            edit=True,
            users=Users.get(),
            team=team,
            members=Users_team.get(team_id=team_id),
        )
示例#5
0
文件: team.py 项目: thomaserlang/TLog
    def get(self, team_id):
        '''
        Renders the edit team form. 

        :param team_id: int
        '''
        team = Team.get(id_=team_id)
        if not team:
            self.error(404, 'Team not found')
        form = forms.Team()
        form.name.data = team.name
        self.render(
            'team.html',
            title=u'Team: {}'.format(team.name),
            form=form,
            edit=True,
            users=Users.get(),
            team=team,
            members=Users_team.get(team_id=team_id),
        )
示例#6
0
 def test_update(self):
     team = self.new_team()
     Team.update(id_=team.id, name='Test 2')
     team = Team.get(id_=team.id)
     self.assertEqual(team.name, u'Test 2')
示例#7
0
 def test_get(self):
     team = self.new_team()
     team = Team.get(id_=team.id)
     self.assertTeam(team)
示例#8
0
 def test_get(self):
     team = self.new_team()
     team = Team.get(id_=team.id)
     self.assertTeam(team)