def generatePerson(first_names, last_names, gender, stu_nationality, city, stu): person = Person() person.fname = random.choice(first_names) person.lname = random.choice(last_names) person.gender = gender domain = ["gmail.com", "hotmail.com", "yahoo.com"] person.email = person.lname + "_" + person.fname + "@" + random.choice( domain) person.full_name = (person.fname, person.lname) person.phone_number = "0" + str(random.randint(600000000, 699999999)) start_birthday = datetime.date(1980, 1, 1) end_birthday = datetime.date(2004, 1, 1) time_between_dates = end_birthday - start_birthday days_between_dates = time_between_dates.days random_number_of_days = random.randrange(days_between_dates) date_of_birth = start_birthday + datetime.timedelta( days=random_number_of_days) person.date_of_birth = date_of_birth.strftime('%Y/%m/%d') person.dob_password = date_of_birth.strftime("%Y%m%d") person.nationality = random.choice(stu_nationality) alphabets = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ] person.street_name = ''.join(random.choice(alphabets) for _ in range(6)) person.number = random.randint(100000, 200000) person.city = random.choice(city) person.postal_code = str(random.randint(1111, 9999)) + str(''.join( random.choice(alphabets) for _ in range(2))) person.stu_program = random.choice(stu) person.start_year = random.randint(2015, 2020) #counselor = ["L. Broglie","M. Planck","L. de Broglie","Planck","B. de Wit"] #person.counselor = random.choice(counselor) password = person.fname + person.dob_password person.password = password return person