def get(self):
		exercise_to_edit = self.request.get('edit')
    	
		if exercise_to_edit:
			try:
				exercise = Exercise.get(db.Key(exercise_to_edit))
				exercise_muscles = ExerciseMuscle.gql('WHERE exercise = :1', exercise)
				self.template_vars['exercise'] = exercise
				self.template_vars['exercise_muscles'] = exercise_muscles
			except db.BadKeyError:
				self.errors.append('The specified exercise could not be found.')
	    		
		muscleQuery = Muscle.all()
		self.template_vars['muscles'] = muscleQuery 
		self.template_path = os.path.join(os.path.dirname(__file__), 'exercise_create_or_edit.html')
		self.dispatch()
Beispiel #2
0
def get_exercise_muscles(exercise):
	exercise_muscles = ExerciseMuscle.all().filter('exercise =', exercise)
	em = []
	for exercise_muscle in exercise_muscles:
		em.append(exercise_muscle)
	return em