Exemplo n.º 1
0
def saveShoppingList():

    """ 
        It saves the shopping list with the ingredients for the recipes in the planner

    """

    list_name = request.form.get('name')
    ingredients = request.form.get('ingredients')
    ingr_aisles = request.form.get('list')

    list_ingredients = ingredients.split(",")


    # Saves each ingredient in the shop_lists table
    for ingr in list_ingredients:

        ShoppingList.addItem(ingr, session['User'], list_name)

    db.session.commit    

    return redirect("/getShoppingLists/"+list_name)