def add_ninja(): new_ninja = Ninja(first_name=request.form['first_name'], last_name=request.form['last_name'], dojo_id=int(request.form['dojo'])) db.session.add(new_ninja) db.session.commit() return redirect('/')
def add(): if request.form['add'] == 'add_dojo': new_dojo = Dojo(name = request.form['name'], city = request.form['city'], state = request.form['state']) db.session.add(new_dojo) elif request.form['add'] == 'add_ninja': new_ninja = Ninja(first_name = request.form['first_name'], last_name = request.form['last_name'], dojo_id = request.form['dojo']) db.session.add(new_ninja) db.session.commit() return redirect("/")
def create_ninja(): new_ninja = Ninja(first_name=request.form['first_name'], last_name=request.form['last_name'], dojo_id=request.form['dojo_id']) db.session.add(new_ninja) db.session.commit() if request.form['page'] == 'ninjas': return redirect('/ninjas') return redirect('/')
def add_ninja(): new_ninja = Ninja(first_name=request.form['first_name'], last_name=request.form['last_name'], dojo=Dojo.query.get(request.form['id'])) print("Adding new ninja...") print(new_ninja) db.session.add(new_ninja) db.session.commit() return redirect("/")
def create_ninja(): first_name = request.form['fname'] last_name = request.form['lname'] dojo = request.form['dojo'] new_ninja = Ninja(first_name=first_name, last_name=last_name, dojo=dojo) db.session.add(new_ninja) db.session.commit() return redirect("/")
def newuser(): print(request.form) dojo_n = request.form['dojo_name'] print(dojo_n) list_of_all_dojos = Dojo.query.all() which_dojo = Dojo.query.filter_by(name=dojo_n).first() print(which_dojo.id) print(request.form) # # dojo_num=which_dojo["id"] new_instance_of_a_ninja = Ninja(first_name=request.form['first_name'], \ last_name=request.form['last_name'], dojo_id=which_dojo.id) print(new_instance_of_a_ninja) db.session.add(new_instance_of_a_ninja) db.session.commit() return redirect("/")
def addNinja(): newNinja = Ninja( first_name=request.form['fName'], last_name=request.form['lName'], dojo_id=request.form['dojoLocation']) db.session.add(newNinja) db.session.commit() return redirect('/')