Пример #1
0
    def put(self, id):
        data = attributes.parse_args()

        parents_id = list(data['parents'].split(","))

        if len(parents_id) > 2:
            return {"message": "Child cannot have more than 2 Parents"}

        child = ChildModel.find_child(id)
        if child:
            child.update_child(data)
            return {'message': 'Updated child'}
        return {'message': 'Child not found'}, 404
Пример #2
0
 def delete(self, id):
     child = ChildModel.find_child(id)
     if child:
         child.delete_child()
         return {'message': 'Child deleted'}
     return {'message': 'Child not found'}, 404
Пример #3
0
 def get(self, id):
     child = ChildModel.find_child(id)
     if child:
         return child.json()
     return {'message': 'Child not found'}, 404