def forest(): if request.method == 'GET': return "Click on the forest" else: userdata = formopener.dict_from(request.form) vre = userdata['Forest'] forest = vre.decode('utf-8') return render_template('forest.html', forest=forest)
def lose(): if request.method == 'GET': return "Click on to continue" else: userdata = formopener.dict_from(request.form) vre = userdata['lose'] lose = vre.decode('utf-8') return render_template('lose.html', lose=lose)
def victory(): if request.method == 'GET': return "Click on for a victory" else: userdata = formopener.dict_from(request.form) vre = userdata['move'] victory = vre.decode('utf-8') return render_template('victory.html', victory=victory)
def enemy(): if request.method == 'GET': return "Click on for enemy" else: userdata = formopener.dict_from(request.form) vre = userdata['enemy'] enemy = vre.decode('utf-8') return render_template('enemy.html', enemy=enemy)
def fight(): if request.method == 'GET': return "Click on to fight" else: userdata = formopener.dict_from(request.form) vre = userdata['fight'] fight = vre.decode('utf-8') return render_template('fight.html', fight=fight)
def character_creation(): if request.method == 'GET': return "Please enter a name" else: userdata = formopener.dict_from(request.form) vre = userdata['choices'] choices = vre.decode('utf-8') return render_template('character_creation.html', choices=choices)
def character_stat(): if request.method == 'GET': return "Please enter a your type of stat" else: userdata = formopener.dict_from(request.form) vre = userdata['stats'] stats = model.stats(vre.decode('utf-8')) return render_template('character_stats.html', stats=stats)
def city(): if request.method == 'GET': return "Click on the city" else: userdata = formopener.dict_from(request.form) vre = userdata['City'] city = vre.decode('utf-8') return render_template('city.html', city=city)
def maps(): if request.method == 'GET': return "Please click for the map" else: userdata = formopener.dict_from(request.form) vre = userdata['Map'] maps = model.stats(vre.decode('utf-8')) return render_template('map.html', maps=maps)
def town(): if request.method == 'GET': return "Click on the town" else: userdata = formopener.dict_from(request.form) vre = userdata['Town'] town = vre.decode('utf-8') return render_template('town.html', town=town)
def start(): if request.method == 'GET': return "Click on to go home" else: userdata = formopener.dict_from(request.form) vre = userdata['start'] start = vre.decode('utf-8') return render_template('index.html', start=start)
def mystery(): if request.method == 'GET': return "Click on for a mystery" else: userdata = formopener.dict_from(request.form) vre = userdata['Mystery'] mystery = vre.decode('utf-8') return render_template('mystery.html', mystery=mystery)
def results(): if request.method == 'GET': return "Please use form" else: userdata = dict_from(request.form) print(userdata) birthMonth = userdata['birthMonth'] birthMonth = model.birthStone(birthMonth) return render_template('results.html', birthMonth=birthMonth)
def handleBreakfast(): if request.method == 'GET': user = {"name": "Sophia", 'color': 'blue', 'animal': 'fox'} weather = {'temperature': '70', 'cloud': 'cloudy'} return render_template("index.html", title = 'Home Page', user = user, weather = weather) else: #For post requests userdata = formopener.dict_from(request.form) #This puts form data into a dictionary nickname = userdata['nickname'] #The key for this dictionary comes from the name of the corresponding input in the <form> on the html breakfast = model.shout(userdata['breakfast']) return render_template('results.html', nickname = nickname, breakfast = breakfast)
def browser_results(): userdata = formopener.dict_from(request.form) answer1 = userdata['answer1'] answer2 = userdata['answer2'] answer3 = userdata['answer3'] answer4 = userdata['answer4'] answer5 = userdata['answer5'] answer6 = userdata['answer6'] browser_total = model.calculate_browser_results(answer1, answer2, answer3, answer4, answer5, answer6) return render_template('browser_results.html', browser_total = browser_total)
def results_drywall(): userdata = formopener.dict_from(request.form) answer1 = userdata['answer1'] answer2 = userdata['answer2'] answer3 = userdata['answer3'] answer4 = userdata['answer4'] answer5 = userdata['answer5'] answer6 = userdata['answer6'] dry_total = model.calculate_dry_results(answer1, answer2, answer3, answer4, answer5, answer6) return render_template('dry_results.html', dry_total = dry_total)
def results(): #store the data from the form as the username username = formopener.dict_from(request.form) #print the userdata to the console so that I can see the dictionary print(username) #store and print the value of the breakfast to the console so that I can see it name = username['name'] name = name.encode("utf-8") print(username['name']) #send the value of breakfast to the results.html page return render_template('results.html', name = name)
def handleBreakfast(): if request.method == 'GET': user = {'name':'Edeline','fav_color':'pink'} weather = {'temperature':"70",'cloud':"cloudy"} return render_template('index.html', title='Home Page', user=user, weather = weather) else: ##this is for POST requests userdata = formopener.dict_from(request.form) #This puts form data into a dictionary nickname = userdata['nickname'] # the key for this dictionary comes from the name of the corresponding input in the <form> on the html breakfast = model.shout(userdata['breakfast']) return render_template('results.html',nickname = nickname, breakfast = breakfast)
def nyc(): if request.method == "GET": return render_template('nyc.html') else: user = formopener.dict_from(request.form) activity = (user["activity"]).decode('utf-8') walking = (user["walking"]).decode('utf-8') crowds = (user["crowds"]).decode('utf-8') activity_generator = model.nyc_activity(activity, walking, crowds) pic = model.image(activity) print(activity_generator) return render_template('nyc.html', activity_generator=activity_generator, pic=pic)
def sendWeather(): if request.method == "POST": user_data = formopener.dict_from(request.form) print(user_data) user_intensity = user_data["intensity"] user_temp = user_data["temperature"] user_wind = user_data["wind"] user_humidity = user_data["humidity"] # For some reason it isn't finding the condition. I commented it out of the html form so that it would run. It wasn't even printing the results of whatever was typed. # user_condition = user_data["conditions"] the_clothes = model.what_to_wear(user_temp, user_humidity, user_wind, user_humidity) return render_template("/results.html", the_clothes=the_clothes) else: return "Please go back and try again."
def results(): if request.method == 'GET': return "Please fill out the form." else: userdata = formopener.dict_from(request.form) print(userdata) name = userdata['name'] genre = userdata['genre'] print(genre) results = model.findPlaylist(genre) playlistlink = results[0] embedlink = results[1] return render_template("results.html", name=name, genre=genre, playlistlink=playlistlink, embedlink=embedlink)
def results(): if request.method == 'GET': return "You should use the form." else: userdata = formopener.dict_from(request.form) num1 = userdata['num1'] num2 = userdata['num2'] product = model.magicianprod(num1, num2) sub1 = model.magiciansub1(num1, num2) sub = model.magiciansub(num1, num2) add = model.magicianadd(num1, num2) print(product) return render_template('results.html', num1=num1, num2=num2, product=product, sub1=sub1, sub=sub, add=add, title="The Magic Ends")
def results1(): if request.method == 'GET': return "Please answer all questions!" else: #this is where to open the form, access items, process userdata = formopener.dict_from(request.form) print(userdata) quizresults = model.quiz1results(userdata["frequency"], userdata["will"]) print(quizresults) level = quizresults[0] genexp = quizresults[1] frequ = quizresults[2] selfwww = quizresults[3] imageimage = quizresults[4] return render_template('results1.html', level=level, genexp=genexp, frequ=frequ, selfwww=selfwww, imageimage=imageimage)
def results_birth(): userdata = formopener.dict_from(request.form) firstname = userdata['firstname'].decode('utf-8') lastname = userdata['lastname'].decode('utf-8') enterbd = userdata['enterbd'].decode('utf-8') return render_template('birthday_results.html', firstname = firstname, lastname = lastname, enterbd = enterbd)
def input(): userdata = formopener.dict_from(request.form) name = userdata['name'] return render_template('input.html', name=name, title="The Magic Begins!")