From 75bf4d3bb56035c82daadf25b9cd7dd8794ebd03 Mon Sep 17 00:00:00 2001 From: pluja Date: Sat, 26 Sep 2020 15:09:26 +0200 Subject: [PATCH] Adds route to display current users --- app/routes.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/routes.py b/app/routes.py index 180c472..544563b 100644 --- a/app/routes.py +++ b/app/routes.py @@ -598,13 +598,18 @@ def register(): return render_template('register.html', title='Register', registrations=REGISTRATIONS, form=form, config=config) -@app.route('/registrations_status') -def registrations_status(): +@app.route('/registrations_status/icon') +def registrations_status_icon(): count = db.session.query(User).count() if count >= config['maxInstanceUsers'] or config['maxInstanceUsers'] == 0: - return url_for('static',filename='img/close.png') + return redirect(url_for('static',filename='img/close.png')) else: - return url_for('static',filename='img/open.png') + return redirect(url_for('static',filename='img/open.png')) + +@app.route('/registrations_status/text') +def registrations_status_text(): + count = db.session.query(User).count() + return "{c}/{t}".format(c=count, t=config['maxInstanceUsers']) @app.route('/error/') def error(errno):