from otree.api import * c = cu doc = 'Initial Room For 4 to 1 Divided Public Goods Game' class Constants(BaseConstants): name_in_url = 'InitialRoomD_4t1' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): consent = models.StringField(choices=[['Yes', 'Yes'], ['No', 'No']], initial='No', label='I have read and understand the explanations. I am over 18 years of age, and I agree to participate in this study.', widget=widgets.RadioSelectHorizontal) party = models.StringField(choices=[['Democrat', 'Democrat'], ['Republican', 'Republican']], label='For the purposes of this experiment, which political party do you identify with?', widget=widgets.RadioSelect) bot_check = models.IntegerField(max=10, min=0) honor_pledge = models.StringField(choices=[[' I pledge to give my full attention to this study', ' I pledge to give my full attention to this study']], widget=widgets.RadioSelect) class Consent_Form(Page): form_model = 'player' form_fields = ['consent'] class Bot_Check(Page): form_model = 'player' form_fields = ['bot_check'] class HonorPledge(Page): form_model = 'player' form_fields = ['honor_pledge'] class Removal(Page): form_model = 'player' @staticmethod def get_form_fields(player): if player.consent == "Yes" and player.bot_check == 8: return ['party'] return [] @staticmethod def before_next_page(player, timeout_happened): participant = player.participant participant.vars['partyid'] = player.party @staticmethod def app_after_this_page(player, upcoming_apps): if player.consent == "Yes" and player.bot_check == 8: return upcoming_apps[0] else: return upcoming_apps[5] page_sequence = [Consent_Form, Bot_Check, HonorPledge, Removal]