def submit_all(): result = askquestion(title="Confirmation", message= "Do you want to process?") if result == "yes": person = Person() person.lname = input_lastname.get(1.0, "end-1c") person.fname = input_firstname.get(1.0, "end-1c") person.birthday = datetime.date(birthYear.get(), months.index(birthMonth.get()) + 1, birthDay.get()) person.nationality = selected_nationality.get() person.gender = selected_gender.get() person.streetNumber = str(input_houseNo.get(1.0, "end-1c")) + str(input_houseNo2.get(1.0, "end-1c")) person.streetname = input_street.get(1.0, "end-1c") person.city = input_city.get(1.0, "end-1c") person.postalCode = str(input_postal.get(1.0, "end-1c")) + str(input_postal2.get(1.0, "end-1c")) person.phone = input_phoneNumber.get(1.0, "end-1c") person.email = input_email.get(1.0, "end-1c") person.insert() teacher = Teacher() teacher.personID = person.personID teacher.salary = input_salary.get(1.0, "end-1c") person.userName = (person.lname + str(teacher.teacherID)) person.userPass = "******" person.update() get_counsellor = selected_counsellor.get() if (get_counsellor == "Yes"): teacher.studycouncelor = 'Y' else: teacher.studycouncelor = 'N' teacher.insert() ui.AdminWindowTeachers.admin_window_teachers(window, return_function) #avoid circular import
def generateTeacher(is_admin=False): person = generatePerson() teacher = Teacher() teacher.salary = random.randint(2500, 6500) teacher.studycouncelor = random.choice(['Y', 'N']) teacher.personID = person.personID teacher.insert() if is_admin: person.userName = "******" else: person.userName = (person.lname + str(teacher.teacherID)) person.userPass = "******" person.email = (person.lname + "." + person.fname + "@diemenacademy.nl") person.update() return teacher