Example #1
0
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)
Example #2
0
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)
Example #3
0
def user_delete(gradebook_number):
    delete_data(Student, gradebook_number)
    save()
    return redirect('/Student')