def coursework_edit(initalization_num): if request.method == 'GET': works = get_data_by_id(CourseWork, initalization_num) result = get_data(CourseWork) form = CourseworkForm() form.initalization_num.data = works.initalization_num form.cwname.data = works.cwname return render_template('Course_work.html', works=result, form=form)
def student_edit(gradebook_number): if request.method == 'GET': students = get_data_by_id(Student, gradebook_number) result = get_data(Student) form = Studform() form.gradebook_number.data = students.gradebook_number form.full_name.data = students.full_name return render_template('Student.html', students=result, form=form)
def forcoursework(): result = get_data(CourseWork) form = CourseworkForm() if request.method == 'POST': print(form.initalization_num.data) works = get_data_by_init(CourseWork, form.initalization_num.data) if (form.initalization_num.data == works.initalization_num): work = Student(int(form.initalization_num.data), form.cwname.data, form.research_direction.data, form.gradebook_number.data) update_data(work, CourseWork) else: work = CourseWork(form.initalization_num.data, form.cwname.data, form.research_direction, form.gradebook_number.data) insert_data(work) save() return redirect('/Course_work') return render_template('Course_work.html', work=result, form=form)
def forstudnt(): result = get_data(Student) form = Studform() if request.method == 'POST': print(form.gradebook_number.data) students = get_data_by_id(Student, form.gradebook_number.data) if (form.gradebook_number.data == students.gradebook_number): students = Student(int(form.gradebook_number.data), form.full_name.data, form.stgroup.data, form.year_of_receipt.data) update_data(students, Student) else: students = Student(form.gradebook_number.data, form.full_name.data, form.stgroup.data, form.year_of_receipt.data) insert_data(students) save() return redirect('/Student') return render_template('Student.html', students=result, form=form)