def POST(self): user_data = web.input() form = familyIdForm() if not form.validates(): return render.index(form, True, "", "") try: guest = model.get_guest(user_data.firstName, user_data.lastName)[0] except IndexError: return render.index(form, False, user_data.firstName, user_data.lastName) guests = model.get_guests(guest.partyName) email_form = mainForm() return render.rsvp(guest.partyName, guests, email_form)
def POST(self): user_data = web.input() email_form = mainForm() num_guests = int(user_data.num_guests) responses = [{ 'partyName': user_data['party_name'], 'firstName': user_data['first_name_%d' % guest_num], 'lastName': user_data['last_name_%d' % guest_num], 'attending': user_data['attending_%d' % guest_num], 'mealChoice': user_data['meal_choice_%d' % guest_num], 'notes': user_data['notes_%d' % guest_num], 'emailAddress': user_data['email'] } for guest_num in range(0, num_guests)] if not email_form.validates(): # ugh, stupid people, we have to go back now... guests = model.get_guests(user_data.party_name) return render.rsvp(user_data.party_name, responses, email_form) yay = False for r in responses: yay = True if r['attending'] == 'Yes' else yay # shove data into the database model.update_guest_responses(responses) # shove the responses into google spreadsheet model_gdata.update_guest_responses(responses) # send an email to the guest to let them know they successfully RSVP-ed web.sendmail('*****@*****.**', user_data['email'], 'Thanks for responding!', email_render.thanks_email(responses, yay), headers={'Content-Type': 'text/html;charset=utf-8'}) # send an email to ourselves web.sendmail('*****@*****.**', '*****@*****.**', 'RSVP: %s' % user_data['party_name'], email_render.thanks_email(responses, yay), headers={'Content-Type': 'text/html;charset=utf-8'}) return render.thanks(yay)
def POST(self): user_data = web.input() email_form = mainForm() num_guests = int(user_data.num_guests) responses = [ {'partyName': user_data['party_name'], 'firstName': user_data['first_name_%d' % guest_num], 'lastName': user_data['last_name_%d' % guest_num], 'attending': user_data['attending_%d' % guest_num], 'mealChoice': user_data['meal_choice_%d' % guest_num], 'notes': user_data['notes_%d' % guest_num], 'emailAddress': user_data['email']} for guest_num in range(0, num_guests) ] if not email_form.validates(): # ugh, stupid people, we have to go back now... guests = model.get_guests(user_data.party_name) return render.rsvp(user_data.party_name, responses, email_form) yay = False for r in responses: yay = True if r['attending']=='Yes' else yay # shove data into the database model.update_guest_responses(responses) # shove the responses into google spreadsheet model_gdata.update_guest_responses(responses) # send an email to the guest to let them know they successfully RSVP-ed web.sendmail('*****@*****.**', user_data['email'], 'Thanks for responding!', email_render.thanks_email(responses, yay), headers={'Content-Type':'text/html;charset=utf-8'}) # send an email to ourselves web.sendmail('*****@*****.**', '*****@*****.**', 'RSVP: %s' % user_data['party_name'], email_render.thanks_email(responses, yay), headers={'Content-Type':'text/html;charset=utf-8'}) return render.thanks(yay)