def post(self): desc = self.request.get('workout') res = self.request.get('result') date = _datetime_from_str(self.request.get('date')) workout = WorkoutLog() if users.get_current_user(): workout.owner = users.get_current_user() workout.description = desc workout.result = res workout.date = date workout.put()
def get(self): workouts = [] if users.get_current_user(): url = users.create_logout_url(self.request.uri) url_linktext = 'Logout' picklink = 2 wkouts = db.GqlQuery("SELECT * FROM WorkoutDefinition WHERE owner = :u", u=users.get_current_user()) else: wkouts = "" url = users.create_login_url(self.request.uri) url_linktext = 'Login' picklink = 1 for wkout in wkouts: workouts.append({'desc': wkout.description, 'logBy': wkout.logBy}) if self.request.get('result') != "": desc = self.request.get('workout') res = self.request.get('result') date = _datetime_from_str(self.request.get('date')) workout = WorkoutLog() if users.get_current_user(): workout.owner = users.get_current_user() workout.description = desc workout.result = res workout.date = date workout.put() template_values = { 'url': url, 'url_linktext': url_linktext, 'picklink': picklink, 'workouts': workouts } path = os.path.join(os.path.dirname(__file__), 'templates/pick.html') self.response.out.write(template.render(path, template_values))