Ejemplo n.º 1
0
def profile():
    user_id = login(request.remote_addr)
    profile = get_profile(user_id)
    recipeList = get_userRecipes(user_id)
    return render_template('profile.html',
                           profile=profile,
                           recipeList=recipeList)
Ejemplo n.º 2
0
def recipe(challenge_id):
    user_id = login(request.remote_addr)
    challenge = get_challenge(user_id, int(challenge_id))
    recipeList = get_recipes(user_id, int(challenge_id))
    return render_template('challengeDetailsPage.html',
                           challenge=challenge,
                           recipeList=recipeList)
Ejemplo n.º 3
0
def add_recipe(challenge_id):
    if request.method == 'POST':

        # Speichere Bild
        image = request.files["image"]
        image.save(os.path.join(app.root_path, 'static', 'img',
                                image.filename))

        user_id = login(request.remote_addr)
        post_recipe(request.form['comment'], image.filename, int(challenge_id),
                    user_id)

    return jsonify(code='200')
Ejemplo n.º 4
0
def vote():
    user_id = login(request.remote_addr)
    challengeList = get_challenges(user_id)
    return render_template('vote.html', challengeList=challengeList)
Ejemplo n.º 5
0
def challengeLike(challenge_id):
    if request.method == 'POST':
        user_id = login(request.remote_addr)
        post_challengeLike(int(user_id), int(challenge_id))
    return jsonify(code='200')