def get_student(school): """create sample student """ name = fake.name() return Student.objects.create(admission_id=fake.name(), first_name=name.split(' ')[0], last_name=name.split(' ')[-1], sex=fake.sex(), date_of_birth=fake.date(), place_of_birth=fake.city(), status=fake.student_status(), residential_address=fake.address(), hometown=fake.city(), nationality='Ghanaian', phone='0200000000', email=fake.email(), school=school)
def create_student(school, **params): """Create a sample recipe and return it""" defaults = { 'admission_id': fake.name(), 'first_name': fake.name().split(' ')[0], 'last_name': fake.name().split(' ')[-1], 'sex': fake.sex(), 'status': fake.student_status(), 'date_of_birth': fake.date(), 'place_of_birth': fake.city(), 'hometown': fake.city(), 'residential_address': fake.address(), 'nationality': 'Ghanaian' } defaults.update(params) # Overwrite or add addtional key/values return Student.objects.create(school=school, **defaults)
def get_student_dafault_payload(**params): """Return sample student payload for only required fields""" name = fake.name() defaults = { 'admission_id': fake.name(), 'first_name': name.split(' ')[0], 'last_name': name.split(' ')[1], 'sex': fake.sex(), 'status': fake.student_status(), 'date_of_birth': fake.date(), 'place_of_birth': fake.city(), 'hometown': fake.city(), 'residential_address': fake.address(), 'nationality': 'Ghanaian', } defaults.update(params) return defaults
def get_school(**params): """Create a sample schol and return it""" defaults = { 'name': fake.name().split(' ')[0], 'level': fake.school_levels(), 'motto': fake.name(), 'code': fake.date(), 'address': fake.address(), 'city': fake.city(), 'region': fake.region(), 'email': fake.email(), } defaults.update(params) # Overwrite or add addtional key/values return School.objects.create(**defaults)
def get_school(): return School.objects.create(name=str(uuid.uuid4())[:9], address=fake.address(), city=fake.city(), region=fake.region())