def get(self): survey_participants = SurveyParticipant.get_all() survey_participant_list = [] for survey_participant in survey_participants: survey_participant_list.append(survey_participant.to_json_dict('full_name', 'email', 'is_starred', 'is_active', 'is_deleted', 'when_created')) response = json.dumps(survey_participant_list) self.response.out.write(response)
def post(self): host_info = get_host_info(self.request) host_info.put() survey_participant = SurveyParticipant() survey_participant.full_name = self.request.get('full_name') survey_participant.designation = self.request.get('designation') survey_participant.department = self.request.get('department') survey_participant.job_type = self.request.get('job_type') survey_participant.organization = self.request.get('organization') survey_participant.organization_website = self.request.get('organization_website') survey_participant.city = self.request.get('city') survey_participant.email = self.request.get('email') survey_participant.mobile_number = self.request.get('mobile_number') survey_participant.host_info = host_info survey_participant.put() queue_mail_task(url='/worker/mail/thanks/survey_participation/', params=dict( full_name=survey_participant.full_name, email = survey_participant.email, survey_link=SURVEY_LINK, key=str(survey_participant.key()) ), method='POST' ) response = render_template('thank_you.html', message_title="Thank you for participating in the survey.", message_body="We appreciate you taking the time to participate in the survey. We shall contact you within 48 hours.") self.response.out.write(response)