def index(self): shared_ingredients = Ingredient.load_all_shared(renamed=True) if current_user.is_authenticated: users_ingredients = Ingredient.load_all_by_author(current_user.username) self.ingredients = users_ingredients + shared_ingredients self.diets = current_user.active_diets else: self.ingredients = shared_ingredients self.diets = None return self.template()
def new(self): from app.helpers.general import list_without_duplicated active_diets = current_user.active_diets user_ingredients = Ingredient.load_all_by_author(current_user.username) shared_ingredients = Ingredient.load_all_shared(renamed=True) ingredients = user_ingredients + shared_ingredients self.ingredients = list_without_duplicated(ingredients) self.preset_ingredients = request.args.get("preset_ingredient_ids", []) self.diets = active_diets self.is_trialrecipe = False return self.template()
def before_all_shared(self): self.shared_ingredients = Ingredient.load_all_shared() self.unapproved_ingredients = Ingredient.load_all_unapproved()
def before_index(self): self.ingredients = Ingredient.load_all_by_author(current_user) self.shared_ingredients = Ingredient.load_all_shared()