def put(self, id): user = User.query.filter_by(id=id).first() if user: # PUT param self.reqparse = reqparse.RequestParser() self.reqparse.add_argument('wish', type = str, location = 'json') args = self.reqparse.parse_args() user.wish = args['wish'] db.session.commit() return user_wish_serializers(id, user.wish) else: return error_serializers('User not found!', 404), 404
def get(self, id): user = User.query.filter_by(id=id).first() if user: return user_wish_serializers(id, user.wish) else: return error_serializers('User not found!', 404), 404