Example #1
0
    def show(self, id):
        self.editing_id = int(request.args.get("editing_id", 0))
        self.public_recipes = Recipe.load_all_public(exclude_mine=True)
        self.daily_recipes = self.daily_plan.daily_recipes
        self.daily_recipes.sort(key=lambda x: x.order_index)

        return self.template()
Example #2
0
    def load_all_in_public_recipes(ordered=True) -> list:
        from app.models.recipes import Recipe
        from app.helpers.general import list_without_duplicated

        ingredients = [x.ingredients for x in Recipe.load_all_public()]
        # flatten
        ingredients = [y for x in ingredients for y in x]
        ingredients = list_without_duplicated(ingredients)

        if ordered:
            ingredients.sort(key=lambda x: unidecode(x.name.lower()))

        return ingredients