def create_dummy_receipes(): receipes = [] for x in range(N_RECEIPES): name = "".join(random.choices(string.ascii_lowercase, k=10)) name = name.capitalize() description = "".join( random.choices(string.ascii_lowercase + " ", k=80)) taste = "".join(random.choices(string.ascii_lowercase, k=5)) new_receipe = model.Receipe(name=name, description=description, taste=taste) receipes.append(new_receipe) receipe_1 = model.Receipe(name="Apfelstrudel", description="Cut Apple Bake Sweet", taste="sweet") receipes.append(receipe_1) receipe_2 = model.Receipe(name="Hamburger", description="Fry Meat And Eat", taste="salty") receipes.append(receipe_2) receipe_3 = model.Receipe(name="Suppe", description="Cut carrots Add Water", taste="sweet") receipes.append(receipe_3) for receipe in receipes: if not db.query(model.Receipe).filter_by(name=receipe.name).first(): db.add(receipe) db.commit()
def create_dummy_receipes(): receipes = [] for x in range(N_RECEIPES): name = "".join(random.choices(string.ascii_lowercase, k=10)) name = name.capitalize() description = "".join( random.choices(string.ascii_lowercase + " ", k=80)) new_receipe = model.Receipe(name=name, description=description) receipes.append(new_receipe) receipe_1 = model.Receipe(name="Receipe 001", description="Description 001") receipes.append(receipe_1) receipe_2 = model.Receipe(name="Receipe 002", description="Description 002") receipes.append(receipe_2) receipe_3 = model.Receipe(name="Receipe 001", description="Description 003") receipes.append(receipe_3) for receipe in receipes: if not db.query(model.Receipe).filter_by(name=receipe.name).first(): db.add(receipe) db.commit()
def blog(): receipe_1 = model.Receipe("Apfelstrudel", "Cut Apple Bake Sweet", "sweet") receipe_2 = model.Receipe("Hamburger", "Fry Meat And Eat", "savioury") receipe_3 = model.Receipe("Suppe", "Cut Carrots Add Water", "salty") return flask.render_template("blog.html", receipes=[receipe_1, receipe_2, receipe_3])