Exemple #1
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")
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 #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
def edit_zombie(id):
    zombie = zombie_repository.select(id)
    zombie_types = zombie_type_repository.select_all()
    return render_template('zombies/edit.html',
                           zombie=zombie,
                           zombie_types=zombie_types)
def show_zombie(id):
    victims = zombie_repository.select_victims_of_zombie(id)
    zombie = zombie_repository.select(id)
    return render_template("zombies/show.html", victims=victims, zombie=zombie)