From 1d3f9fbc7305c720ce07c2712cb6cf2a82ba5333 Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 2 Sep 2019 15:35:02 +1000 Subject: [PATCH] implement bot back button --- templates/bot_create.html | 2 +- webui.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/bot_create.html b/templates/bot_create.html index 533e391..3f84fc7 100644 --- a/templates/bot_create.html +++ b/templates/bot_create.html @@ -40,7 +40,7 @@
Cancel {% if session['step'] != 1 %} - + Back {% endif %} {% if session['step'] < 5 %} diff --git a/webui.py b/webui.py index 7b31517..a492f68 100644 --- a/webui.py +++ b/webui.py @@ -41,6 +41,7 @@ def home(): bot_users = {} for bot in bots: + # multiple SELECTS is slow, maybe SELECT all at once and filter with python? c.execute("SELECT COUNT(*) FROM `bot_learned_accounts` WHERE bot_id = %s", (bot['id'],)) bot_users[bot['id']] = c.fetchone()[0] @@ -187,6 +188,11 @@ def bot_create(): return render_template("bot_create.html") +@app.route("/bot/create/back") +def bot_create_back(): + session['step'] -= 1 + return redirect(url_for("bot_create"), 303) + @app.route("/do/authenticate_bot") def do_authenticate_bot(): session['code'] = request.args.get('code')