from otree.api import * author = 'Nathaniel Burke' doc = """ Gender priming questions for identity experiment """ class Constants(BaseConstants): name_in_url = 'questionnaire' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): campusliving = models.IntegerField( choices=[[0, 'Off Campus'], [1, 'On Campus']], label='Do you normally live on campus or off campus?', widget=widgets.RadioSelect, ) roommate = models.IntegerField( choices=[[0, 'I do not have a roommate'], [1, 'I have a roommate']], label='Do you normally have a roommate?', widget=widgets.RadioSelect, ) floorsex = models.IntegerField( choices=[[0, 'Single Sex'], [1, 'Co-ed']], label='Is your floor single sex or co-ed?', widget=widgets.RadioSelect, ) floorsexpref = models.IntegerField( choices=[[0, 'Single Sex'], [1, 'Co-ed']], label='Do you prefer a single sex floor or co-ed?', widget=widgets.RadioSelect, ) environmentsex = models.IntegerField( choices=[[0, 'Single Sex'], [1, 'Co-ed']], label='Is your living environment single sex or co-ed?', widget=widgets.RadioSelect, ) environmentsexpref = models.IntegerField( choices=[[0, 'Single Sex'], [1, 'Co-ed']], label='Do you prefer a single sex living environment or co-ed?', widget=widgets.RadioSelect, ) prefreason1 = models.StringField(label='Reason 1') prefreason2 = models.StringField(label='Reason 2') prefreason3 = models.StringField(label='Reason 3') cellphonepref = models.IntegerField( choices=[[0, 'Android'], [1, 'iPhone']], label='Which smartphone operating system do you prefer?', widget=widgets.RadioSelect, ) videopref = models.IntegerField( choices=[[0, 'Voice Calls'], [1, 'Video Calls']], label='Do you prefer voice calls or video calls?', widget=widgets.RadioSelect, ) laptoppref = models.IntegerField( choices=[[0, 'Laptop Computer'], [1, 'Desktop Computer']], label='Do you prefer using a laptop computer or a desktop computer?', widget=widgets.RadioSelect, ) mobilesitepref = models.IntegerField( choices=[[0, 'Mobile App'], [1, 'Mobile Website']], label='Do you prefer a mobile app or a mobile website?', widget=widgets.RadioSelect, ) touchscrenpref = models.IntegerField( choices=[[0, 'Keyboard/Keypad'], [1, 'Touchscreen']], label='Do you prefer using a keyboard/keypad or a touchscreen?', widget=widgets.RadioSelect, ) remotepref = models.IntegerField( choices=[[0, 'Remote Control'], [1, 'Smartphone']], label='Do you prefer using a remote control or your smartphone to control smart devices such as a smart TV?', widget=widgets.RadioSelect, ) # FUNCTIONS # PAGES class Priming(Page): @staticmethod def is_displayed(player: Player): if player.session.config['treatment'] == 1: return True elif player.session.config['treatment'] == 2: return True elif player.session.config['treatment'] == 3: return False elif player.session.config['treatment'] == 4: return False form_model = 'player' form_fields = [ 'campusliving', 'roommate', 'floorsex', 'floorsexpref', 'environmentsex', 'environmentsexpref', 'prefreason1', 'prefreason2', 'prefreason3', ] class NoPriming(Page): @staticmethod def is_displayed(player: Player): if player.session.config['treatment'] == 1: return False elif player.session.config['treatment'] == 2: return False elif player.session.config['treatment'] == 3: return True elif player.session.config['treatment'] == 4: return True form_model = 'player' form_fields = [ 'cellphonepref', 'videopref', 'laptoppref', 'mobilesitepref', 'touchscrenpref', 'remotepref', 'prefreason1', 'prefreason2', 'prefreason3', ] page_sequence = [Priming, NoPriming]