def duplicateAJAX(self): if request.json.get("ingredient_id") is None: abort(500) new_ingredient = Ingredient.load(request.json["ingredient_id"]).duplicate() new_ingredient.save() result = {"ingredient_id": new_ingredient.id} return jsonify(result)
def before_request(self, name, id=None, *args, **kwargs): self.ingredient = Ingredient.load(id)
def before_request(self, name, id=None, *args, **kwargs): self.ingredient = Ingredient.load(id) if self.ingredient: self.validate_show(self.ingredient)