def create_trainer(): name = request.form["name"] email = request.form["email"] phone = request.form["phone"] specialism = request.form["specialism"] new_trainer = Trainer(name, email, phone, specialism) trainer_repository.save(new_trainer) return redirect("/trainers")
from models.pokemon import Pokemon from models.trainer import Trainer import repositories.nurse_repository as nurse_repository import repositories.pokemon_repository as pokemon_repository import repositories.trainer_repository as trainer_repository # pokemon_repository.delete_all() # nurse_repository.delete_all() # trainer_repository.delete_all() nurse_1 = Nurse("Joy", "Fire") nurse_repository.save(nurse_1) trainer = Trainer("Simon", 12345) trainer_repository.save(trainer) pokemon = Pokemon('Seed Backman', 'Bulbasaur', 'Grass', '25/09/1990', trainer , 'burned') pokemon.assign_nurse(nurse_1) pokemon_repository.save(pokemon) trainer.name = 'Simondovich' trainer_repository.update(trainer) nurse_1.name = "Betsy"
def register_trainer(): name = request.form['name'] number = request.form['number'] trainer = Trainer(name, number) trainer_repository.save(trainer) return redirect('/trainers')
import pdb from models.trainer import Trainer from models.exercise_class import ExerciseClass import repositories.trainer_repository as trainer_repository import repositories.exercise_class_repository as exercise_class_repository exercise_class_repository.delete_all() trainer_repository.delete_all() trainer_1 = Trainer('Oli Saunders', '*****@*****.**', "+447758135514", 'Endurance Training') trainer_repository.save(trainer_1) trainer_2 = Trainer('Cassia Briscoe', '*****@*****.**', "+447438132414", 'Weight loss') trainer_repository.save(trainer_2) trainer_3 = Trainer('Damien Young', '*****@*****.**', "+447438155514", 'Strength Training') trainer_repository.save(trainer_3) class_1 = ExerciseClass('Cycho Spin', 'Cardio', 60, "2nd December", trainer_1) exercise_class_repository.save(class_1) class_2 = ExerciseClass('Yoga', 'Flexibility and Core', 45, "4th December", trainer_2) exercise_class_repository.save(class_2) class_3 = ExerciseClass('Bodypump', 'Strength Training', 60, "4th December", trainer_2)
def create_trainer(): name = request.form['name'] new_trainer = Trainer(name) trainer_repository.save(new_trainer) return redirect("/trainers")