Merge branch 'master' of git.elab.kth.se:davide/KUKapp

master
Davide Bongiovanni 6 years ago
commit 616840676f

@ -154,6 +154,15 @@ def addme():
else: else:
return render_template('appresponse.html', message='You are already a registered eater') return render_template('appresponse.html', message='You are already a registered eater')
@app.route("/removeme")
@login_required
def removeme():
meal_id = request.args.get('meal')
query = 'UPDATE meals SET eaters = array_remove(eaters, :user_id) where id = :meal_id;'
r = db_engine.execute(text(query), user_id=current_user.user_id, meal_id = meal_id)
return render_template('appresponse.html', message='You were removed from that meal')
@app.route('/') @app.route('/')
def index(): def index():
meals, _ = getUpcomingMeals() meals, _ = getUpcomingMeals()

Loading…
Cancel
Save