示例#1
0
def get_student():
    hackbright_app.connect_to_db()
    student_github = request.args.get("student")
    name = hackbright_app.get_student_by_github(student_github)
    # first_name=name[0]
    # last_name=name[1]
    # github=name[2]
    grades = hackbright_app.student_grades(name[0], name[1])
    html = render_template("student_info.html", first_name=name[0], last_name=name[1], github=name[2], grades=grades)
    return html
示例#2
0
def get_student():
    hackbright_app.connect_to_db()
    first_name = request.args.get("first_name")
    last_name = request.args.get("last_name")
    rows = hackbright_app.student_grades(first_name, last_name)
    if len(rows) == 0:
        html = render_template("student_info.html", first_name=first_name,
                                                last_name=last_name)
    else:
        grades = []
        for row in rows:
            grades.append((row[2],row[3]))
        html = render_template("student_info.html", first_name=row[0],
                                                    last_name=row[1],
                                                    grades=grades)
    return html