Пример #1
0
def edit_pokemon_page(id):
    pokemon = pokemon_repository.select(id)
    nurses = nurse_repository.select_all()
    trainers = trainer_repository.select_all()
    return render_template("/pokemon/edit.html",
                           pokemon=pokemon,
                           nurses=nurses,
                           trainers=trainers)
def assign_nurse():
    nurse_id = request.form['nurse_id']
    pokemon_id = request.form['pokemon_id']
    nurse = nurse_repository.select(nurse_id)
    pokemon = pokemon_repository.select(pokemon_id)
    nurse.assign_pokemon(pokemon)
    # pdb.set_trace()
    pokemon_repository.update(pokemon)
    return redirect('/nurses/index')
def update_pokemon(id):
    pokemon = pokemon_repository.select(id)
    name = request.form["name"]
    trainer = request.form['trainer']
    species = request.form['species']
    hatched = request.form['hatched']
    nurse_id = request.form['nurse_id']
    nurse = nurse_repository.select(nurse_id)
    notes = request.form['notes']
    pokemon = Pokemon(name, trainer, species, hatched, nurse, notes)
    pokemon.id = id
    pokemon_repository.update(pokemon)
    return redirect("/pokemons/index")
Пример #4
0
def discharge_pokemon(id):
    pokemon = pokemon_repository.select(id)
    pokemon.status = "Healthy"
    pokemon_repository.update(pokemon)
    return redirect("/pokemon/sick")
Пример #5
0
def info(id):
    pokemons = []
    pokemons.append(pokemon_repository.select(id))
    return render_template("pokemon/info.html", pokemons=pokemons)
def edit_pokemon(id):
    pokemon = pokemon_repository.select(id)
    nurses = nurse_repository.select_all()
    return render_template('pokemons/edit.html', pokemon=pokemon, nurses = nurses)