예제 #1
0
def add_slack():
    try:
        code = request.args.get('code')
        # state = request.args.get('state')

        # An empty string is a valid token for this request
        temp_sc = SlackClient("")

        # Request the auth tokens from Slack
        auth_response = temp_sc.api_call("oauth.access",
                                         client_id=SLACK_CLIENT_ID,
                                         client_secret=SLACK_CLIENT_SECRET,
                                         code=code)

        user_token = auth_response['access_token']
        bot_token = auth_response['bot']['bot_access_token']
        team_id = auth_response['team_id']
        team_name = auth_response['team_name']
        team = Team(code=code,
                    bot_token=bot_token,
                    user_token=user_token,
                    team_name=team_name,
                    team_id=team_id)
        team.save()
        return render_template('add_successful.html')
    except:  # noqa: #722
        return render_template('error.html')
예제 #2
0
파일: Team.py 프로젝트: vmm86/younoshi
def updateTeam(cityid, schoolid, teamid):
    # Получение полей формы из шаблона
    teamname = request.form['teamName']
    ageid    = request.form['filterAge']

    # Обновление текущей записи в БД
    if session['demo']:
        pass
    else:
        team           = Team()
        team.team_ID   = teamid
        team.school_ID = schoolid
        team.age_ID    = ageid
        team.teamName  = teamname
        team.save()

    # Редирект на вид list
    return redirect(
        url_for('listTeam', 
            cityid   = cityid, 
            schoolid = schoolid,
            teamid   = teamid))
예제 #3
0
from model import Bid, Team, User, Auction, User_access, Auction_result, database
import datetime

database.drop_tables([Bid, Team, User, Auction, User_access, Auction_result])
database.create_tables([Bid, Team, User, Auction, User_access, Auction_result])

duke = Team(team="Duke Blue Devils")
duke.save()

georgetown = Team(team="Georgetown Hoyas")
georgetown.save()

gonzaga = Team(team="Gonzaga Bulldogs")
gonzaga.save()

alex = User(username='******',
            email='*****@*****.**',
            first_name='Alex',
            last_name='Laws')
alex.set_password('admin')
alex.save()

chris = User(username='******',
             email='*****@*****.**',
             first_name='Chris',
             last_name='Bubernak')
chris.set_password('captain')
chris.save()

keith = User(username='******',
             email='*****@*****.**',