示例#1
0
    def put(self, id):
        parsed_args = parser.parse_args()
        hub = db_session.query(Hub).filter(Hub.id == id).first()
        if not hub:
            abort(404, message="Hub doesn't exist".format(id))

        hub.name = parsed_args['name']
        db_session.add(hub)
        db_session.commit()
        return hub.as_dict(), 201
示例#2
0
    def put(self, id):
        parsed_args = parser.parse_args()
        hub = db_session.query(Hub).filter(Hub.id == id).first()
        if not hub:
            abort(404, message="Hub doesn't exist".format(id))

        hub.name = parsed_args['name']
        db_session.add(hub)
        db_session.commit()
        return hub.as_dict(), 201
示例#3
0
 def post(self):
     parsed_args = parser.parse_args()
     hub = Hub(name=parsed_args['name'])
     db_session.add(hub)
     db_session.commit()
     return hub.as_dict(), 201
示例#4
0
 def post(self):
     parsed_args = parser.parse_args()
     hub = Hub(name=parsed_args['name'])
     db_session.add(hub)
     db_session.commit()
     return hub.as_dict(), 201