コード例 #1
0
ファイル: views.py プロジェクト: timerdmann/stoutsd
def load_nhl(request):
    """Populate the data store with an initial set of games."""
    games = csv.reader(open(os.path.dirname(__file__) + '/../../nhl.csv', 'r'))
    gs = []
    for game in games:
        year = int(game[0])
        month = int(game[1])
        day = int(game[2])
        hour = int(game[3])
        minute = int(game[4])
        second = int(game[5])
        # dst = int(game[6])
        team1 = game[7]
        team2 = game[8]
        tzinfo = eastern_time
        dtstart = datetime.datetime(year, month, day, hour, minute, second, 0, tzinfo)
        g = Game(sport='NHL', team1=team1, team2=team2, dtstart=dtstart)
        g.put()
        gs.append(g)

    return render_admin_template('admin/games.html', dict(games=gs))