Beispiel #1
0
def get_staff_dafault_payload(**params):
    """Return sample staff payload for only required fields"""
    name = fake.name()
    defaults = {
        'first_name': name.split(' ')[0],
        'last_name': name.split(' ')[1],
        'sex': fake.sex(),
        'date_of_birth': fake.date(),
        'address': fake.address(),
        'email': fake.email()
    }
    defaults.update(params)
    return defaults
Beispiel #2
0
def get_staff(school, **params):
    """Create a sample staff and return it"""
    defaults = {
        'first_name': fake.name().split(' ')[0],
        'last_name': fake.name().split(' ')[-1],
        'sex': fake.sex(),
        'date_of_birth': fake.date(),
        'address': fake.address(),
        'email': fake.email()
    }
    defaults.update(params)  # Overwrite or add addtional key/values

    return Staff.objects.create(school=school, **defaults)
Beispiel #3
0
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)
Beispiel #4
0
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)
Beispiel #5
0
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