def put(self, list_id): ilist = ListModel.find_by_id(list_id) ilist_data = list_schema.load(request.get_json()) if ilist: ilist.title = ilist_data.title else: ilist_data.save_to_db() ilist.save_to_db() return list_schema.dump(ilist)
def delete(self, list_id): ilist = ListModel.find_by_id(list_id) if ilist: ilist.delete_from_db() return{"message":"list deleted"}, 200 return{"message":"list not found"}
def get(self, list_id): ilist = ListModel.find_by_id(list_id) if ilist: return ilist.json() return {"message":"not found"}, 404