"list staffers pdf"

This commit is contained in:
Doug Le Tough 2018-05-09 10:26:17 +02:00
parent 3a183a48b8
commit e313608090

View File

@ -1040,11 +1040,38 @@ def update_staff_slot(TURN_ID, SLOT_ID):
@check_session @check_session
def list_users(): def list_users():
""" Users list """ """ Users list """
message = check_user_info()
try:
if session['is_admin']:
page = str(request.url_rule) page = str(request.url_rule)
menu = get_menu(page) menu = get_menu(page)
message = check_user_info()
staffers = Tetawebapp_users.query.filter(Tetawebapp_users.is_admin==0, Tetawebapp_users.link_id==None).order_by(Tetawebapp_users.name).all() staffers = Tetawebapp_users.query.filter(Tetawebapp_users.is_admin==0, Tetawebapp_users.link_id==None).order_by(Tetawebapp_users.name).all()
return render_template('list_users.html', menu=menu, staffers=staffers, message=message) return render_template('list_users.html', menu=menu, staffers=staffers, message=message)
# User is not admin
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
except:
# User is not logged in
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
@app.route("/users/pdf", methods=['GET', 'POST'])
@check_session
def print_users():
""" Print user list """
message = check_user_info()
try:
if session['is_admin']:
page = str(request.url_rule)
menu = get_menu(page)
staffs = Tetawebapp_staffs.query(Tetawebapp_staffs.user_id).distinct()
staffers = Tetawebapp_users.query.filter(Tetawebapp_users.is_admin==0, Tetawebapp_users.link_id==None).order_by(Tetawebapp_users.name).all()
sstaffers = [staffer for staffer in staffers if staffer.id in staffs]
return sstaffers
# User is not admin
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
except:
# User is not logged in
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
@app.route("/account/<ID>", methods=['GET', 'POST']) @app.route("/account/<ID>", methods=['GET', 'POST'])
@check_session @check_session