def select(id):
    sql = "SELECT * FROM bitings WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    human = human_repository.select(result["human_id"])
    zombie = zombie_repository.select(result["zombie_id"])
    biting = Biting(human, zombie, result["id"])
    return biting
Exemple #2
0
def update_biting(id):
    human_id = request.form["human_id"]
    zombie_id = request.form["zombie_id"]
    human = human_repository.select(human_id)
    zombie = zombie_repository.select(zombie_id)
    biting = Biting(human, zombie, id)
    biting_repository.update(biting)
    return redirect("/bitings")
Exemple #3
0
def create_biting():
    human_id = request.form["human_id"]
    zombie_id = request.form["zombie_id"]
    human = human_repository.select(human_id)
    zombie = zombie_repository.select(zombie_id)
    new_biting = Biting(human, zombie)
    biting_repository.save(new_biting)
    return redirect("/bitings")
def select_all():
    bitings = []
    sql = "SELECT * FROM bitings"
    results = run_sql(sql)
    for result in results:
        human = human_repository.select(result["human_id"])
        zombie = zombie_repository.select(result["zombie_id"])
        biting = Biting(human, zombie, result["id"])
        bitings.append(biting)
    return bitings
Exemple #5
0
def select_all():
    bitings_list = []
    sql = "SELECT * FROM bitings"
    results = run_sql(sql)

    for row in results:
        human = human_repository.select(row['human_id'])
        zombie = zombie_repository.select(row['zombie_id'])
        biting = Biting(human, zombie, row['id'])
        bitings_list.append(biting)
    return bitings_list
Exemple #6
0
def edit_human(id):
    human = human_repository.select(id)
    return render_template('humans/edit.html', human=human)