From 28f4ce1af22f8d3206de095d0b96df7ea16f2fbf Mon Sep 17 00:00:00 2001 From: Doug Le Tough Date: Tue, 26 Feb 2019 15:31:34 +1100 Subject: [PATCH] Admin can select staffer --- participate.py | 15 ++++++++++++++- templates/staffsheet.html | 12 ++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/participate.py b/participate.py index 6332de8..7b981d2 100755 --- a/participate.py +++ b/participate.py @@ -544,6 +544,17 @@ def turns_list(): ######################################################################## # Staffs ######################################################################## +def get_staffers(): + try: + staffers = Tetawebapp_users.query(Tetawebapp_users.id > 1).all() + return staffers + except Exception as e: + print "[+] Error at get_staffers:" + print "------------------------------" + print "%s" % e.message + print "------------------------------" + return False + def get_staffs(): """ """ try: @@ -853,14 +864,16 @@ def logout(): @check_session def staffsheet(): try: + is_admin = session['is_admin'] user_id = session['user_id'] if len(check_user_info()) == 0: page = str(request.url_rule) menu = get_menu(page) turns = turns_list() staffs = get_staffs() + staffers = get_staffers() roles = get_roles() - return render_template('staffsheet.html', menu=menu, turns=turns, staffs=staffs, user_id=user_id, roles=roles, message='') + return render_template('staffsheet.html', menu=menu, turns=turns, staffs=staffs, staffers=staffers, user_id=user_id, is_admin=is_admin, roles=roles, message='') else: return account() except AttributeError as e: diff --git a/templates/staffsheet.html b/templates/staffsheet.html index ca064c5..2617e35 100644 --- a/templates/staffsheet.html +++ b/templates/staffsheet.html @@ -68,6 +68,18 @@ {% endif %} {% if user_id == sslot[0].user_id %}
{{ sslot[1] }}
+ {% elif is_admin %} +
+ +
{% else %}
{{ sslot[1] }}
{% endif %}