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)
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)
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')
def vote(): user_id = login(request.remote_addr) challengeList = get_challenges(user_id) return render_template('vote.html', challengeList=challengeList)
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')