コード例 #1
0
ファイル: server.py プロジェクト: SeanOBoyle/brew-app-project
def editrecipe(recipe):
    name, source, style, batch_size, batch_units, notes, hop_steps, ext_steps, ferm_steps, misc_steps, yeast_steps, srm_color = get_recipe_info(recipe)
    grain_choice, extract_choice, hop_choice, misc_choice, yeast_choice, selectlist_styles = feed_recipe_form()

    public = Recipe.query.filter_by(name=recipe).one().public
    return render_template("editrecipe.html", name=name, source=source, style=style, batch_size=batch_size, batch_units=batch_units,
                           public=public, notes=notes, hop_steps=hop_steps, ext_steps=ext_steps, ferm_steps=ferm_steps,
                           misc_steps=misc_steps, yeast_steps=yeast_steps, grain_choice=grain_choice,
                           extract_choice=extract_choice, hop_choice=hop_choice, misc_choice=misc_choice,
                           yeast_choice=yeast_choice, selectlist_styles=selectlist_styles)
コード例 #2
0
ファイル: server.py プロジェクト: SeanOBoyle/brew-app-project
def show_explore():

    if session:
        selectlist_recipes, selectlist_styles, selectlist_user, sel_user_styles = get_selectlists(session["user_id"])
        new = True
    else:
        selectlist_recipes, selectlist_styles, selectlist_user, sel_user_styles = get_selectlists(9999)
        new = True

    # For recipe selected, show recipe.
    if request.method == "POST":
        # Render either recipe list for style selection or recipe
        if request.form.get("style"):
            style = request.form.get("style")
            list_recipes = []
            for recipe in Recipe.query.filter_by(style_name=style).all():
                list_recipes.append(recipe.name)
            return render_template("explore_brews.html", list_recipes=list_recipes,
                                   selectlist_recipes=selectlist_recipes,
                                   selectlist_styles=selectlist_styles)
        elif request.form.get("recipe"):
            recipe = request.form.get("recipe")
            name, source, style, batch_size, batch_units, notes, hop_steps, ext_steps, ferm_steps, misc_steps, yeast_steps, srm_color = get_recipe_info(recipe)
            print "SERVER SRM ", srm_color
            color = color_conversion(srm_color)
            deleteable = False
            if session["user_id"] and Recipe.query.filter_by(name=recipe).one().user_id == session["user_id"]:
                deleteable = True
            return render_template("explore_brews.html", selectlist_recipes=selectlist_recipes, batch_size=batch_size,
                                   selectlist_styles=selectlist_styles, name=name, source=source, color=color, style=style,
                                   notes=notes, hop_steps=hop_steps, ext_steps=ext_steps, ferm_steps=ferm_steps,
                                   misc_steps=misc_steps, yeast_steps=yeast_steps, deleteable=deleteable)

    return render_template("explore_brews.html", new=new, selectlist_recipes=selectlist_recipes,
                           selectlist_styles=selectlist_styles, selectlisrt_user=selectlist_user,
                           sel_user_styles=sel_user_styles, session=session)
コード例 #3
0
ファイル: server.py プロジェクト: SeanOBoyle/brew-app-project
def get_recipes(recipe):
    selectlist_recipes, selectlist_styles, selectlist_user, sel_user_styles = get_selectlists(session["user_id"])
    deleteable = False
    if Recipe.query.filter_by(name=recipe).one().user_id == session["user_id"]:
        deleteable = True
    name, source, style, batch_size, batch_units, notes, hop_steps, ext_steps, ferm_steps, misc_steps, yeast_steps, srm_color = get_recipe_info(recipe)
    color = color_conversion(srm_color)
    return render_template("explore_brews.html", selectlist_recipes=selectlist_recipes, batch_size=batch_size,
                           selectlist_styles=selectlist_styles, name=name, source=source, color=color, style=style,
                           notes=notes, hop_steps=hop_steps, ext_steps=ext_steps, ferm_steps=ferm_steps,
                           misc_steps=misc_steps, yeast_steps=yeast_steps, deleteable=deleteable)