示例#1
0
    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)
示例#2
0
 def before_request(self, name, id=None, *args, **kwargs):
     self.ingredient = Ingredient.load(id)
示例#3
0
 def before_request(self, name, id=None, *args, **kwargs):
     self.ingredient = Ingredient.load(id)
     if self.ingredient:
         self.validate_show(self.ingredient)