def get(self): workout_key = self.request.get('workout') try: workout = Workout.get(db.Key(workout_key)) except db.BadKeyError: raise "PossibleHackingAttempt" workout_exercises = WorkoutExercise.all().filter('workout =', workout) self.template_vars['workout'] = workout self.template_vars['workout_exercises'] = workout_exercises self.template_path = os.path.join(os.path.dirname(__file__), 'workout_view.html') self.dispatch()
def get_workout_exercises(workout): workout_exercises = WorkoutExercise.all().filter('workout =', workout) we = [] for workout_exercise in workout_exercises: we.append(workout_exercise) return we