def select(id): sql = "SELECT * FROM senseis WHERE id = %s" values = [id] result = run_sql(sql, values)[0] waza = waza_repository.select(result["waza_id"]) sensei = Sensei(result["name"], waza, result["id"]) return sensei
def select_all(): senseis = [] sql = "SELECT * FROM senseis" results = run_sql(sql) for result in results: waza = waza_repository.select(result["waza_id"]) sensei = Sensei(result["name"], waza, result["id"]) senseis.append(sensei) return senseis
def select_all(): deshis = [] sql = "SELECT * FROM deshis" results = run_sql(sql) for row in results: waza = waza_repository.select(row["waza_id"]) deshi = Deshi(row["name"], waza, row["id"]) deshis.append(deshi) return deshis
def show_waza(id): waza = waza_repository.select(id) sensei = waza_repository.senseis(waza) deshi = waza_repository.deshis(waza) return render_template("wazas/show.html", waza = waza, sensei = sensei, deshi = deshi)
def update_sensei(id): name = request.form['name'] waza = waza_repository.select(request.form['waza_id']) sensei = Sensei(name, waza, id) sensei_repository.update(sensei) return redirect('/senseis')
def create_sensei(): name = request.form['name'] waza = waza_repository.select(request.form['waza_id']) sensei = Sensei(name, waza) sensei_repository.save(sensei) return redirect('/senseis')
def update_deshi(id): name = request.form['name'] waza = waza_repository.select(request.form['waza_id']) deshi = Deshi(name, waza, id) deshi_repository.update(deshi) return redirect('/deshis')
def create_deshi(): name = request.form['name'] waza = waza_repository.select(request.form['waza_id']) deshi = Deshi(name, waza) deshi_repository.save(deshi) return redirect('/deshis')