def grade_student(): github = request.form.get("github") grade = request.form.get("grade") project_title = request.form.get("project_title") print "webapp.py", github, project_title, grade hackbright_app.assign_grade_to_student(github, project_title, grade) print "**********", request.referrer if "project" in request.referrer: return redirect('/project?project_title='+project_title) elif "student" in request.referrer: return redirect('/student?student='+github)
def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("student") kwargs = {} if request.args.get("grade") and request.args.get("project_title"): #then set the thing in the database and render it in the html project_title = request.args.get("project_title") grade = request.args.get("grade") hackbright_app.assign_grade_to_student(student_github, project_title, grade) kwargs["project_title"]=project_title kwargs["grade"]=grade row = hackbright_app.get_student_by_github(student_github) grades_row = hackbright_app.show_grade_by_student(student_github) kwargs = {"first_name" : row[0], "last_name" : row[1], "github" : row[2], "grade_rows" : grades_row} html = render_template("student_info.html", **kwargs) return html
def assign_grade(): hackbright_app.connect_to_db() project_title = request.args.get('title') grade = request.args.get('grade') first_name = request.args.get('first_name') last_name = request.args.get('last_name') assign_grade = hackbright_app.assign_grade_to_student(first_name,last_name,project_title,grade) return redirect("/grades?title="+project_title)