示例#1
0
文件: webapp.py 项目: myun/sql_lesson
def get_studentgrades():
    hackbright_app.connect_to_db()
    student_github = request.args.get("student")
    rows = hackbright_app.get_grades_by_student(student_github)
    html = render_template("student_info.html", rows = rows , student_github = student_github) 
# Note need to put student_github in there so it passes through Jinja - left side goes to Jinja/html, right side references python var
    return html
示例#2
0
def get_student():
    hackbright_app.connect_to_db()
    student_github = request.args.get("github")
    row = hackbright_app.get_student_by_github(student_github)
    row2 = hackbright_app.get_grades_by_student(row[0], row[1])
    html = render_template("student_info.html", first_name=row[0], last_name=row[1], github=row[2], grade=row2)
    return html
示例#3
0
def added_new_grade():
    hackbright_app.connect_to_db()
    student_git = request.args.get("student_git")
    project_name = request.args.get("project_name")
    grade = request.args.get("grade")
    hackbright_app.add_new_grade(student_git, project_name, grade)
    rows = hackbright_app.get_grades_by_student(student_git)
    html = render_template("student_info.html", rows=rows,
                                                github=student_git)
    return html
示例#4
0
def get_student_grades():
    hackbright_app.connect_to_db()
    student_github = request.args.get("github")
    rows = hackbright_app.get_grades_by_student(student_github)

    # html = ""
    # for item in rows:
    #     html = html + render_template("get_grades.html", github=item[0],
    #                                     project=item[1], grade=item[2])
    html = render_template("get_grades.html", rows=rows)
    return html
示例#5
0
def get_student():
    hackbright_app.connect_to_db()
    student_github = request.args.get("github") 
    student = hackbright_app.get_student_by_github(student_github)
    grades = hackbright_app.get_grades_by_student(student_github)
    html = render_template("student_info.html", grades=grades,
                                                first_name=student[0],
                                                last_name=student[1],
                                                student_github=student_github
                                                )
    return html
示例#6
0
def get_student_grades():
    hackbright_app.connect_to_db()
    student_github = request.args.get("github")
    rows = hackbright_app.get_grades_by_student(student_github)

    # html = ""
    # for item in rows:
    #     html = html + render_template("get_grades.html", github=item[0],
    #                                     project=item[1], grade=item[2])
    html = render_template("get_grades.html", rows=rows)
    return html
示例#7
0
def get_grade():
    hackbright_app.connect_to_db()
    student_github = request.args.get("student")
    rows = hackbright_app.get_grades_by_student(student_github)
    projects = [] # created a list of dictionaries for html loop
    for title, grade in rows:
        row_dict = {}
        row_dict['github'] = student_github
        row_dict['project_title'] = title
        row_dict['grade'] = grade
        projects.append(row_dict)
    html = render_template("grade_info.html", projects = projects) # set html variable 'projects' to projects dict
    return html
示例#8
0
def get_student():
    hackbright_app.connect_to_db()
    student_github = request.args.get("github")
    student_github_tuple = hackbright_app.get_student_by_github(student_github)
    first_name = student_github_tuple[0]
    last_name = student_github_tuple[1]
    github = student_github_tuple[2]
    
    student_grades_list = hackbright_app.get_grades_by_student(first_name,last_name)
    # title = student_grades_tuple[0]
    # grade = student_grades_tuple[1]
    # max_grade = student_grades_tuple[2]

    html = render_template("student_info.html", first_name=first_name,
                                                last_name=last_name,
                                                github=github,
                                                student_grades_list=student_grades_list)
    return html
示例#9
0
def get_student():
    hackbright_app.connect_to_db()
    student_git = request.args.get("github")
    rows = hackbright_app.get_grades_by_student(student_git)
    html = render_template("student_info.html", github = student_git, rows = rows)
    return html