Пример #1
0
def update_keiko(id):
    sensei = sensei_repository.select(request.form['sensei_id'])
    time    = request.form['time']
    deshi = deshi_repository.select(request.form['deshi_id'])
    keiko = Keiko(sensei, time, deshi, id)
    keiko_repository.update(keiko)
    return redirect('/keikos')
Пример #2
0
def select(id):
    sql = "SELECT * FROM keikos WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    deshi = deshi_repository.select(result["deshi_id"])
    sensei = sensei_repository.select(result["sensei_id"])
    keiko = Keiko(sensei, result["time"], deshi, result["id"])
    return keiko
Пример #3
0
def select_all():
    keikos = []
    sql = "SELECT * FROM keikos"
    results = run_sql(sql)
    for result in results:
        deshi = deshi_repository.select(result["deshi_id"])
        sensei = sensei_repository.select(result["sensei_id"])
        keiko = Keiko(sensei, result["time"], deshi, result["id"])
        keikos.append(keiko)
    return keikos
Пример #4
0
def edit_deshi(id):
    deshi = deshi_repository.select(id)
    wazas = waza_repository.select_all()
    return render_template('deshis/edit.html', deshi=deshi, all_wazas=wazas)
Пример #5
0
def show_deshi(id):
    deshi = deshi_repository.select(id)
    return render_template('deshis/show.html', deshi=deshi)