Exemplo n.º 1
0
def edit_user(sid):
    if request.method == "POST":
        form = request.form
        email = form["email"]
        cell = form["cell"]
        osis = form["osis"]
        dob = form["dob"]
        grad_year = form["grad_year"]
        team_dues = form.get("team_dues", 0)
        safety_test = form.get("safety_test", 0)
        medicals = form.get("medicals", 0)
        home_phone = form["home_phone"]
        mother = form["mother"]
        mother_email = form["mother_email"]
        mother_cell = form["mother_cell"]
        father = form["father"]
        father_email = form["father_email"]
        father_cell = form["father_cell"]
        pref_lang = form["pref_lang"]

        data = []
        data.append(sid)
        data.append([grad_year, osis, dob])
        data.append([email, cell])
        data.append([team_dues, safety_test, medicals])
        data.append([mother, mother_email, mother_cell, father, father_email, father_cell, home_phone, pref_lang])
        userdb.update_user(data)
        flash("Updated user", "success")

    return render_template("admin_edit_student.html", INFO=userdb.get_user_data(sid))
Exemplo n.º 2
0
def edit_user(sid):
    if request.method == "POST":
        form = request.form
        email = form["email"]
        cell = form["cell"]
        osis = form["osis"]
        dob = form["dob"]
        grad_year = form["grad_year"]
        team_dues = form.get("team_dues", 0)
        safety_test = form.get("safety_test", 0)
        medicals = form.get("medicals", 0)
        home_phone = form["home_phone"]
        mother = form["mother"]
        mother_email = form["mother_email"]
        mother_cell = form["mother_cell"]
        father = form["father"]
        father_email = form["father_email"]
        father_cell = form["father_cell"]
        pref_lang = form["pref_lang"]

        data = []
        data.append(sid)
        data.append([grad_year, osis, dob])
        data.append([email, cell])
        data.append([team_dues, safety_test, medicals])
        data.append([
            mother, mother_email, mother_cell, father, father_email,
            father_cell, home_phone, pref_lang
        ])
        userdb.update_user(data)
        flash("Updated user", "success")

    return render_template("admin_edit_student.html",
                           INFO=userdb.get_user_data(sid))
Exemplo n.º 3
0
def admin_console(sid=-1):
    if not userdb.id_exists(sid):
        if request.method == "GET":
            return render_template("admin_dashboard.html")
        else:
            # Sanity check
            assert(request.method == "POST")
            # The form on the admin console is the filter.
            filtered = userdb.get_data_with_filter(request.form)
            # If get_data_with_filter returns an empty dictionary
            if not filtered:
                flash("No users meet the criteria", "danger")
                return render_template("admin_dashboard.html")
            else:
                flash("Here are the results:", "success")
                return render_template("admin_dashboard.html", users=filtered)
    else:
        return render_template("admin_view_student.html",
                INFO=userdb.get_user_data(sid))
Exemplo n.º 4
0
def admin_console(sid=-1):
    if not userdb.id_exists(sid):
        if request.method == "GET":
            return render_template("admin_dashboard.html")
        else:
            # Sanity check
            assert (request.method == "POST")
            # The form on the admin console is the filter.
            filtered = userdb.get_data_with_filter(request.form)
            # If get_data_with_filter returns an empty dictionary
            if not filtered:
                flash("No users meet the criteria", "danger")
                return render_template("admin_dashboard.html")
            else:
                flash("Here are the results:", "success")
                return render_template("admin_dashboard.html", users=filtered)
    else:
        return render_template("admin_view_student.html",
                               INFO=userdb.get_user_data(sid))
Exemplo n.º 5
0
def student_check():
    info = userdb.get_user_data(session['sid'])
    return render_template("student_dashboard.html", INFO=info)
Exemplo n.º 6
0
def student_check():
    info = userdb.get_user_data(session['sid'])
    return render_template("student_dashboard.html", INFO=info)