from otree.api import * c = cu doc = '' class Constants(BaseConstants): name_in_url = 'InitialRoom' 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) 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'], ['No, I do not pledge', 'No, I do not pledge']], widget=widgets.RadioSelect) bot_check = models.IntegerField(max=10, min=0) norm = models.StringField(choices=[['Hospitality', 'Hospitality'], ['Self-Reliance', 'Self-Reliance']], label='Under normal times (before or after Covid) if a friend of yours were coming to town would you more likely support the norm of hospitality or the norm of self-reliance?', widget=widgets.RadioSelectHorizontal) onorm_feeling = models.IntegerField(max=10, min=0) class ConsentForm(Page): form_model = 'player' form_fields = ['consent'] class BotCheck(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 and player.honor_pledge != "No, I do not pledge": return ['norm', 'onorm_feeling'] return [] @staticmethod def before_next_page(player, timeout_happened): participant = player.participant participant.vars['norm'] = player.norm @staticmethod def app_after_this_page(player, upcoming_apps): if player.consent == "Yes" and player.bot_check == 8 and player.honor_pledge != "No, I do not pledge": return upcoming_apps[0] else: return upcoming_apps[2] page_sequence = [ConsentForm, BotCheck, HonorPledge, Removal]