def edit_animal_page(id):
    vets = vet_repository.select_all_vets()
    owners = owner_repository.select_all_owners()
    chosen_animal = animal_repository.select_animal(id)
    animals = animal_repository.select_all_animals()
    animals = sorted(animals, key=lambda animal:animal.name)

    return render_template('animals/index.html', owners=owners, vets=vets, chosen_animal=chosen_animal, animals=animals, edit_info=True, more_info=True)
def more_owner_info(id):
    owners = owner_repository.select_all_owners()
    print(len(owners))
    owners = sorted(owners, key=lambda owner: owner.name)
    chosen_owner = owner_repository.select_owner(id)
    animals = owner_repository.get_all_animals(chosen_owner)
    return render_template('/owners/index.html',
                           animals=animals,
                           more_info=True,
                           chosen_owner=chosen_owner,
                           owners=owners)
def edit_owner_page(id):
    chosen_owner = owner_repository.select_owner(id)
    owners = owner_repository.select_all_owners()
    owners = sorted(owners, key=lambda owner: owner.name)
    animals = owner_repository.get_all_animals(chosen_owner)
    return render_template('owners/index.html',
                           animals=animals,
                           owners=owners,
                           more_info=True,
                           edit_info=True,
                           chosen_owner=chosen_owner)
Ejemplo n.º 4
0
                  vet_3)
animal_4 = Animal("Gerry", "13/2/2020", "Giraffe", owner_4,
                  "Easy to find in a busy shop", vet_4)

vet_repository.save_new_vet(vet_1)
vet_repository.save_new_vet(vet_2)
vet_repository.save_new_vet(vet_3)
vet_repository.save_new_vet(vet_4)

owner_repository.save_new_owner(owner_1)
animal_repository.save_new_animal(animal_1)
owner_repository.save_new_owner(owner_2)
animal_repository.save_new_animal(animal_2)
owner_repository.save_new_owner(owner_3)
animal_repository.save_new_animal(animal_3)
owner_repository.save_new_owner(owner_4)
animal_repository.save_new_animal(animal_4)
animal_repository.save_new_animal(animal_5)

# vet_repository.update_vet(vet_1)
# owner_repository.update_owner(owner_1)
# animal_repository.update_animal(animal_1)

print(animal_repository.select_animal(1))
print(vet_repository.select_vet(1))
print(owner_repository.select_owner(1))

print(animal_repository.select_all_animals())
print(owner_repository.select_all_owners())
print(vet_repository.select_all_vets())
def new_animal_page():
    owners = owner_repository.select_all_owners()
    vets = vet_repository.select_all_vets()
    return render_template('/animals/new.html', vets=vets, owners=owners)
def owner_page():
    owners = owner_repository.select_all_owners()
    owners = sorted(owners, key=lambda owner: owner.name)
    return render_template('/owners/index.html', owners=owners)