def edit(self, id): self.form = create_form(IngredientForm, obj=self.ingredient) if self.ingredient.is_used: self.form.calorie.errors = [] self.form.protein.errors = [] self.form.fat.errors = [] self.form.sugar.errors = [] return self.template()
def show_token(self): token = request.args["token"] form = create_form(NewPasswordForm) user = User.load(token, load_type="new_password_token") if user is None: flash("tento token již není platný", "error") return redirect(url_for("LoginView:show")) return template( "auth/new_password.html.j2", form=form, username=user.username, token=token )
def edit(self, id, **kwargs): self.editing_id = int(request.args.get("editing_id", 0)) self.show_fast_add = request.args.get("show_fast_add", False) self.ingredient_form = IngredientForm() self.form = create_form(RecipeForm, obj=self.recipe) self.personal_ingredients = sorted( self.recipe.unused_personal_ingredients, key=lambda x: unidecode(x.name.lower()), ) self.public_ingredients = sorted( self.recipe.unused_public_ingredients, key=lambda x: unidecode(x.name.lower()), ) return self.template()
def edit(self): self.user_form = create_form(UserForm, obj=self.user) return self.template()
def edit(self): self.user_form = create_form(UserForm, obj=self.user) self.password_form = create_form(PasswordForm) return self.template()
def show(self): form = create_form(LoginForm) return template("auth/login.html.j2", form=form)
def show(self): form = create_form(GetNewPasswordForm) return template("auth/get_new_password.html.j2", form=form)
def new(self): self.form = create_form(IngredientForm) return self.template()
def new_shared(self): # TODO can be simplified -> redirect? calling super with kwargs? form = create_form(IngredientForm) return self.template("ingredients/new.html.j2", form=form, shared=True)
def show(self): form = create_form(RegisterForm) return template("auth/register.html.j2", form=form)
def before_edit(self, id): self.form = create_form(IngredientForm, obj=self.ingredient) self.recipes = Recipe.load_by_ingredient_and_user( self.ingredient, current_user) self.all_recipes = Recipe.load_by_ingredient(self.ingredient)
def before_new(self): self.form = create_form(IngredientForm)
def edit(self, id): self.form = create_form(DietForm, obj=self.diet) return self.template()
def new(self): self.form = create_form(DietForm) return self.template()
def new(self): self.form = create_form(RecipeForm) return self.template()