Пример #1
0
def schedule():
    info_msgs = []
    if g.user.has_not_registered_schedule_yet():
        info_msgs.append(u'未登録の練習があります:' +
                u'参加/不参加の登録をお願いします。<br>' +
                u'予定が未定な方は、とりあえず参加/不参加どちらかで登録' +
                u'して、あとで更新してもらっても構いません。')
    ps = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_PRACTICE)]
    gs = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_GAME)]
    es = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_EVENT)]
    return render_template('schedule.html',
                           practices=ps, games=gs, events=es,
                           info_msgs=info_msgs)
Пример #2
0
Файл: mobile.py Проект: kzkn/fc
def find_user_and_schedule(sid):
    user = users.find_by_id(get_userid())
    if not user:
        abort(401)
    s = scheds.find_by_id(sid)
    if not s:
        abort(404)
    return (user, scheds.from_row(s))
Пример #3
0
def edit_schedule(id, module):
    if request.method == 'GET':
        s = scheds.from_row(scheds.find_by_id(id, with_entry=False))
        return render_template(module['edit_template'], schedule=s)
    else:
        moduletype = module['type']
        logi('edit schedule: type=%d, sid=%d', moduletype, id)
        try:
            module['validate']()
        except ValueError, e:
            logi('edit schedule: validation error type=%d, sid=%d, errors=%s', moduletype, id, e.errors.keys())
            s = scheds.from_row(scheds.find_by_id(id, with_entry=False))
            return render_template(module['edit_template'], schedule=s,
                    errors=e.errors)

        obj = module['make_obj'](request.form)
        logi('edit schedule: update type=%d, sid=%d, when=%s, body=%s', moduletype, id, obj['when'], obj['body'])
        scheds.update(id, obj['when'], obj['body'])
        return redirect(url_for(module['index']))
Пример #4
0
def delete_schedule(id, module):
    if request.method == 'GET':
        s = scheds.from_row(scheds.find_by_id(id))
        return render_template(module['delete_template'], schedule=s)
    else:
        if is_yes():
            logi('delete schedule: type=%d, sid=%d', module['type'], id)
            scheds.delete_by_id(id)
        else:
            logi('not delete schedule: type=%d, sid=%d', module['type'], id)
        return redirect(url_for(module['index']))
Пример #5
0
Файл: mobile.py Проект: kzkn/fc
def practices():
    user = users.find_by_id(get_userid())
    if not user:
        abort(401)
    ps = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_PRACTICE)]
    return render_template("mobile/practices.html", user=user, practices=ps)
Пример #6
0
Файл: mobile.py Проект: kzkn/fc
def non_registered_practices():
    user = users.find_by_id(get_userid())
    if not user:
        abort(401)
    ps = [scheds.from_row(s) for s in scheds.find_non_registered(user.id, scheds.TYPE_PRACTICE)]
    return render_template("mobile/practices.html", user=user, practices=ps, info_msg=u"未登録の練習があります。")
Пример #7
0
Файл: mobile.py Проект: kzkn/fc
def events():
    user = users.find_by_id(get_userid())
    if not user:
        abort(401)
    es = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_EVENT)]
    return render_template("mobile/events.html", user=user, events=es)
Пример #8
0
Файл: mobile.py Проект: kzkn/fc
def games():
    user = users.find_by_id(get_userid())
    if not user:
        abort(401)
    gs = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_GAME)]
    return render_template("mobile/games.html", user=user, games=gs)
Пример #9
0
def show_event(id):
    s = scheds.from_row(scheds.find_by_id(id))
    return render_template("admin/show_event.html", schedule=s)
Пример #10
0
def event_history():
    es = [scheds.from_row(s) for s in scheds.find_dones(scheds.TYPE_EVENT)]
    ys, es = schedules_group_by_year(es)
    return render_template('admin/event_history.html', years=ys, events=es)
Пример #11
0
def game_history():
    gs = [scheds.from_row(s) for s in scheds.find_dones(scheds.TYPE_GAME)]
    ys, gs = schedules_group_by_year(gs)
    return render_template('admin/game_history.html', years=ys, games=gs)
Пример #12
0
def practice_history():
    ps = [scheds.from_row(s) for s in scheds.find_dones(scheds.TYPE_PRACTICE)]
    ys, ps = schedules_group_by_year(ps)
    return render_template('admin/practice_history.html', years=ys, practices=ps)
Пример #13
0
def event():
    es = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_EVENT)]
    return render_template('admin/event.html', events=es)
Пример #14
0
def game():
    gs = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_GAME)]
    return render_template('admin/game.html', games=gs)
Пример #15
0
def practice():
    ps = [scheds.from_row(s) for s in scheds.find(scheds.TYPE_PRACTICE)]
    return render_template('admin/practice.html', practices=ps)