Beispiel #1
0
def show_student_selection(username):
    """Displayroute."""
    cma_db = model.get_db()
    children = get_children(cma_db, username)

    if flask.request.method == 'POST':
        firstname = flask.request.form.get('firstname', False)
        lastname = flask.request.form.get('lastname', False)
        username = flask.request.form.get('username', False)
        password = flask.request.form.get('password', False)

        cma_db = model.get_db()
        add_account(cursor=cma_db.cursor(),
                    username=username,
                    firstname=firstname,
                    lastname=lastname,
                    password=password,
                    acc_type="p")

        flask.session['username'] = username
        return flask.render_template("student_selection.html",
                                     username=username,
                                     children=children)

    return flask.render_template("student_selection.html",
                                 username=username,
                                 children=children)
Beispiel #2
0
def show_student_portal_lesson1(username):
    if 'username' not in flask.session:
        return flask.redirect(flask.url_for('show_login_page'))
    cma_db = model.get_db()
    logname = flask.session["username"]

    return flask.render_template("lesson1.html", logname=username)
Beispiel #3
0
def show_parent_portal(username, childname):
    if 'username' not in flask.session:
        return flask.redirect(flask.url_for('show_login_page'))
    cma_db = model.get_db()
    logname = flask.session["username"]

    return flask.render_template("parent.html",
                                 logname=username,
                                 child=childname)
Beispiel #4
0
def show_admin_selection(username):
    if 'username' not in flask.session:
        return flask.redirect(flask.url_for('show_login_page'))

    cma_db = model.get_db()
    logname = flask.session["username"]

    student_firstname = flask.request.form.get('firstname', False)
    student_lastname = flask.request.form.get('lastname', False)

    return flask.render_template("admin_student.html",
                                 logname=username,
                                 firstname=student_firstname,
                                 lastname=student_lastname)
Beispiel #5
0
def show_register():
    """Display /account/create route."""
    if flask.request.method == 'POST':
        firstname = flask.request.form.get('firstname', False)
        lastname = flask.request.form.get('lastname', False)
        username = flask.request.form.get('username', False)
        password = flask.request.form.get('password', False)

        cma_db = model.get_db()
        add_account(cursor=cma_db.cursor(),
                    username=username,
                    firstname=firstname,
                    lastname=lastname,
                    password=password,
                    acc_type="p")

        flask.session['username'] = username
        return flask.redirect(flask.url_for('show_login'))

    return flask.render_template("register.html")
Beispiel #6
0
def show_student_progress(username, childname):
    """Display /account/create route."""
    if flask.request.method == 'POST':
        firstname = flask.request.form.get('firstname', False)
        lastname = flask.request.form.get('lastname', False)
        username = flask.request.form.get('username', False)
        password = flask.request.form.get('password', False)

        cma_db = model.get_db()
        add_account(cursor=cma_db.cursor(),
                    username=username,
                    firstname=firstname,
                    lastname=lastname,
                    password=password,
                    acc_type="p")

        flask.session['username'] = username
        return flask.render_template(("parent.html"),
                                     logname=username,
                                     child=firstname)

    return flask.render_template("student_progress.html",
                                 child=childname,
                                 username=username)
Beispiel #7
0
def get_parent_info(username):
    cursor = model.get_db()
    parent_info = cursor.execute('''SELECT * FROM parent WEHRE username=?''',
                                 (username, )).fetchall()