Esempio n. 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 works is not None:
            if form.initalization_num.data == works.initalization_num:
                works = CourseWork(int(form.initalization_num.data),
                                   form.gradebook_number.data,
                                   form.cwname.data,
                                   form.research_direction.data,
                                   form.mark.data)
                update_data(works, CourseWork)
            else:
                works = CourseWork(form.initalization_num.data,
                                   form.gradebook_number.data,
                                   form.cwname.data,
                                   form.research_direction.data,
                                   form.mark.data)
                insert_data(works)
        else:
            works = CourseWork(form.initalization_num.data,
                               form.gradebook_number.data, form.cwname.data,
                               form.research_direction.data, form.mark.data)
            insert_data(works)
        save()
        return redirect('/Course_work')
    return render_template('Course_work.html', works=result, form=form)
Esempio n. 2
0
def forsubject():
    result = get_data(Subject)
    form = Subj_form()
    if request.method == 'POST':
        print(form.pass_num.data)
        subjects = get_data_by_passn(Subject, form.pass_num.data)
        if subjects is not None:
            if form.pass_num.data == subjects.pass_num:
                subjects = Subject(int(form.pass_num.data), form.sbname.data,
                                   form.student_rating.data,
                                   form.gradebook_number.data,
                                   form.pass_number.data)
                update_data_s(subjects, Subject)
            else:
                subjects = Subject(form.pass_num.data, form.sbname.data,
                                   form.student_rating.data,
                                   form.gradebook_number.data,
                                   form.pass_number.data)
                insert_data(subjects)
        else:
            subjects = Subject(form.pass_num.data, form.sbname.data,
                               form.student_rating.data,
                               form.gradebook_number.data,
                               form.pass_number.data)
            insert_data(subjects)
        save()
        return redirect('/Subjects')
    return render_template('Subjects.html', subjects=result, form=form)
Esempio n. 3
0
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)
Esempio n. 4
0
def house_edit(build_num):
    if request.method == 'GET':
        houses = get_data_by_build_num(House, build_num)
        result = get_data(House)
        form = HouseForm()
        form.build_num.data = houses.build_num
        form.adress.data = houses.adress
        return render_template('House.html', houses=result, form=form)
Esempio n. 5
0
def subj_edit(pass_num):
    if request.method == 'GET':
        subjects = get_data_by_passn(Subject, pass_num)
        result = get_data(Subject)
        form = Subj_form()
        form.pass_num.data = subjects.pass_num
        form.sbname.data = subjects.sbname
        return render_template('Subjects.html', subjects=result, form=form)
Esempio n. 6
0
def teach_edit(pass_number):
    if request.method == 'GET':
        teachers = get_data_by_pass(Teacher, pass_number)
        result = get_data(Teacher)
        form = TeacherForm()
        form.pass_number.data = teachers.pass_number
        form.full_name.data = teachers.full_name
        return render_template('Teacher.html', teachers=result, form=form)
Esempio n. 7
0
def work_edit(initalization_num):
    if request.method == 'GET':
        works = get_data_by_init(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)
Esempio n. 8
0
def forhouse():
    result = get_data(House)

    if request.method == 'POST':
        print(form.build_num.data)
        houses = get_data_by_build_num(House, form.build_num.data)
        if houses is not None:
            if form.build_num.data == houses.build_num:
                houses = House(int(form.build_num.data), form.adress.data,
                               form.floors.data, form.years.data)
                update_data_b(houses, House)
            else:
                houses = House(form.build_num.data, form.adress.data,
                               form.floors.data, form.years.data)
                insert_data(houses)
        else:
            houses = House(form.build_num.data, form.adress.data,
                           form.floors.data, form.years.data)
            insert_data(houses)
        save()
        return redirect('/House')
    return render_template('House.html', houses=result, form=form)
Esempio n. 9
0
def forteacher():
    result = get_data(Teacher)
    form = TeacherForm()
    if request.method == 'POST':
        print(form.pass_number.data)
        teachers = get_data_by_pass(Teacher, form.pass_number.data)
        if teachers is not None:
            if form.pass_number.data == teachers.pass_number:
                teachers = Teacher(int(form.pass_number.data),
                                   form.full_name.data, form.department.data)
                update_data_t(teachers, Teacher)
            else:
                teachers = Teacher(form.pass_number.data, form.full_name.data,
                                   form.department.data)
                insert_data(teachers)
        else:
            teachers = Teacher(form.pass_number.data, form.full_name.data,
                               form.department.data)
            insert_data(teachers)
        save()
        return redirect('/Teacher')
    return render_template('Teacher.html', teachers=result, form=form)
Esempio n. 10
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 students is not None:
            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)
        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)