Ejemplo n.º 1
0
    def post(self):
        logging.info("generate")
        q = self.request.get('workout')
        by = int(self.request.get('logBy'))
        workout = WorkoutDefinition()
        if users.get_current_user():
            workout.owner = users.get_current_user()

        workout.description = q
        workout.logBy = by

        workout.put()
Ejemplo n.º 2
0
    def get(self):
        if self.request.get('logBy') != "":
            logging.info("define")
            q = self.request.get('workout')
            by = int(self.request.get('logBy'))
            workout = WorkoutDefinition()
            if users.get_current_user():
                workout.owner = users.get_current_user()

            workout.description = q
            workout.logBy = by

            workout.put()

            response_data = {"workout": q, "logBy": by}
            self.response.out.write(json.dumps(response_data))
        else:
            response_data = {"error": "there was a problem storing your workout"}
            self.response.out.write(json.dumps(response_data))