def post(self): p = helper.get_user_profile(helper.get_user_email()) if p: pass else: p = UserProfile() p.first_name = self.request.get('first_name') p.last_name = self.request.get('last_name') p.email = helper.get_user_email() p.friends = [] p.interest = [] interest_list = helper.original_interest_list for interest in interest_list: if (self.request.get(interest) and not (interest in p.interest)): p.interest.append(interest) if (not self.request.get(interest) and interest in p.interest): p.interest.remove(interest) p.put() # self.response.write(renderer.render_template( # self, "profile_view.html", values)) self.redirect('/profile-view')
def get(self): values = helper.get_template_parameters() email = helper.get_user_email() p = helper.get_user_profile(email) if p: values['user_interest'] = helper.get_user_interest(email) values['prospects'] = friends_suggestion.find_suggestions( self.request.get('interest_wanted')) renderer.render_template(self, "main_page.html", values) else: self.redirect('/profile-edit')
def get(self): values = helper.get_template_parameters() email = helper.get_user_email() values['first_name'] = helper.get_user_first_name(email) values['last_name'] = helper.get_user_last_name(email) values['interest_list'] = list() for interest in helper.get_user_interest(email): i = random.randint(1, 3) values['interest_list'].append({ 'interest': interest, 'image': '/i/images/' + interest.lower() + '/image' + str(i) + '.JPG' }) renderer.render_template(self, "profile_view.html", values)
def get(self): values = helper.get_template_parameters() email = helper.get_user_email() p = helper.get_user_profile(email) interest_list = helper.original_interest_list user_interest_state = [] if p: user_interest = helper.get_user_interest(helper.get_user_email()) for interest in interest_list: user_interest_state.append({ 'name': interest, 'value': interest in user_interest }) print user_interest_state values['interest_list'] = user_interest_state values['first_name'] = helper.get_user_first_name(email) values['last_name'] = helper.get_user_last_name(email) else: for interest in interest_list: user_interest_state.append({'name': interest, 'value': False}) values['interest_list'] = user_interest_state renderer.render_template(self, "edit_profile.html", values)
def find_suggestions(user_interest): results = [] for prospect in UserProfile.query(): email = prospect.email if user_interest in helper.get_user_interest(email) and not ( email == helper.get_user_email()): t = { 'first_name': helper.get_user_first_name(email), 'last_name': helper.get_user_last_name(email), 'email': email } #print t results.append(t) # for profile in results: # email = profile.email # results.append((helper.get_user_first_name(email), # helper.get_user_last_name(email), # email)) if (len(results) < 1): return [("There are", "no", "matches")] return results