from otree.api import * class C(BaseConstants): NAME_IN_URL = 'demographic_survey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.StringField( label="How old are you?" ) grades = models.IntegerField( label="What was your average grade for your first semester exams?", choices=[ [1, 'Below 50'], [2, '50-59'], [3, '60-69'], [4, '70-79'], [5, '80-89'], [6, 'Above 90'] ], widget=widgets.RadioSelect ) study = models.IntegerField( label="What year of study are you currently busy with?", choices=[ [1, 'First'], [2, 'Second'], [3, 'Third'], [4, 'Honours'], [5, 'Masters'], [6, 'PhD'] ], widget=widgets.RadioSelect ) gender = models.IntegerField( label="What is your gender?", choices=[ [1, 'Male'], [2, 'Female'], [3, 'Non-binary'], [4, 'Other'], [5, 'Prefer not to say'] ], widget=widgets.RadioSelect ) race = models.IntegerField( label="What is your race?", choices=[ [1, 'Black'], [2, 'Coloured'], [3, 'Indian'], [4, 'Asian'], [5, 'White'], [6, 'Other'], [7, 'Prefer not to say'] ], widget=widgets.RadioSelect ) income = models.IntegerField( label="How do you think your family income compares to that of other UP students ?", choices=[ [1, 'Below average'], [2, 'About average'], [3, 'Above average'] ], widget=widgets.RadioSelect ) religious = models.IntegerField( label="How religious are you?", choices=[ [1, 'Not at all religious'], [2, 'Not very religious'], [3, 'Fairly religious'], [4, 'Very religious'] ], widget=widgets.RadioSelect ) risk = models.IntegerField( label='Please answer the following question related to your risk attitude', choices=[ [1, 'Invest R0: if the coin showed heads, you would get R200; if the coin showed tails, you would get R200'], [2, 'Invest R40: if the coin showed heads, you would get R280; if the coin showed tails, you would get R160'], [3, 'Invest R80: if the coin showed heads, you would get R360; if the coin showed tails, you would get R120'], [4, 'Invest R120: if the coin showed heads, you would get R440; if the coin showed tails, you would get R80'], [5, 'Invest R160: if the coin showed heads, you would get R520; if the coin showed tails, you would get R40'], [6, 'Invest R200: if the coin showed heads, you would get R600; if the coin showed tails, you would get R0'] ], widget=widgets.RadioSelect ) # Pages class Demographics(Page): form_model = 'player' form_fields = [ 'age', 'grades', 'study', 'gender', 'race', 'income', 'religious', ] class Risk(Page): form_model = 'player' form_fields = ['risk'] page_sequence = [Demographics, Risk]