def put(self, name): data = self.parser.parse_args() item = ItemModel.find_by_name(name) if item is None: item = ItemModel(**data) else: item.price = data["price"] item.save_to_db() return item.json, 200
def put(self, name): requested_data = Item.parser.parse_args() item = ItemModel.find_by_name(name) if item is None: item = ItemModel(name, **requested_data) else: item.price = requested_data["price"] item.save_to_db() return item.json()
def put(self, name): data = Item.parser.parse_args() item = ItemModel.find_by_name(name) if item is None: item = ItemModel(name, data['price'], data["store_id"]) else: item.price = data['price'] item.save_to_db() return item.json()