from otree.api import * c = cu doc = '' class C(BaseConstants): NAME_IN_URL = 'Instructions' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField(label='What is your age? ', max=64, min=18) born_in_us = models.BooleanField(choices=[[True, 'Yes'], [False, 'No']], label='Are you born in the United States? ', widget=widgets.RadioSelect) gender = models.BooleanField(choices=[[True, 'Male'], [False, 'Female']], label='What is your gender? ') lottery = models.IntegerField(choices=[[1, 'Lottery 1'], [2, 'Lottery 2']], label='', widget=widgets.RadioSelectHorizontal) class Welcome(Page): form_model = 'player' class Wait1(WaitPage): wait_for_all_groups = True class Experiment(Page): form_model = 'player' class Wait2(WaitPage): wait_for_all_groups = True class Decisions(Page): form_model = 'player' class Wait3(WaitPage): wait_for_all_groups = True class EarningsGame(Page): form_model = 'player' class Wait4(WaitPage): pass class InfoScreen(Page): form_model = 'player' class Wait5(WaitPage): wait_for_all_groups = True class CollectInfo(Page): form_model = 'player' form_fields = ['gender', 'age', 'born_in_us'] @staticmethod def before_next_page(player: Player, timeout_happened): participant = player.participant participant.age = player.age if player.gender == True: participant.gender = "Male" else: participant.gender = "Female" if player.born_in_us == True: participant.born_in_us = "Yes" else: participant.born_in_us = "No" class Wait6(WaitPage): pass class DecisionScreen(Page): form_model = 'player' class Wait7(WaitPage): wait_for_all_groups = True class PaymentScreen(Page): form_model = 'player' class Wait8(WaitPage): wait_for_all_groups = True class Summary(Page): form_model = 'player' class Wait9(WaitPage): wait_for_all_groups = True page_sequence = [Welcome, Wait1, Experiment, Wait2, Decisions, Wait3, EarningsGame, Wait4, InfoScreen, Wait5, CollectInfo, Wait6, DecisionScreen, Wait7, PaymentScreen, Wait8, Summary, Wait9]