from otree.api import * doc = """ Survey, Akdeniz & Mathew, 2022, Normative versus prosocial underpinnings of human decision making. """ class Constants(BaseConstants): name_in_url = 'survey' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): def make_field(label): return models.IntegerField( choices=[[1, 'Strongly disagree'], [2, 'Slightly disagree'], [3, 'Neither agree nor disagree'], [4, 'Slightly agree'], [5, 'Strongly agree']], label=label, widget=widgets.RadioSelectHorizontal, ) age = models.IntegerField(label='', min=13, max=125) gender_tr = models.StringField( label='', ) language = models.StringField(label='',) study = models.StringField(label='',) religious = models.BooleanField( choices=[[0, 'No'], [1, 'Yes']], label='', widget=widgets.RadioSelectHorizontal, ) religion = models.StringField( label='', ) religion_strength = models.IntegerField( choices=[[1, 'Very weakly'], [2, 'Somewhat weakly'], [3, 'Not weakly nor strongly'], [4, 'Somewhat strongly'], [5, 'Very strongly']], label='', widget=widgets.RadioSelectHorizontal, ) religion_freq = models.IntegerField( choices=[[1, 'Very rarely'], [2, 'Somewhat rarely'], [3, 'Not rarely nor frequently'], [4, 'Somewhat frequently'], [5, 'Very frequently']], label='', widget=widgets.RadioSelectHorizontal, ) political = models.StringField( choices=[['Left', 'Left'], ['Center left', 'Center left'], ['Center', 'Center'], ['Center right', 'Center right'], ['Right', 'Right']], label='', widget=widgets.RadioSelectHorizontal, ) crt1 = models.IntegerField( label='', ) crt2 = models.IntegerField( label='', ) crt3 = models.StringField( label='', ) crt4 = models.FloatField( label='', ) tight1 = make_field('There are many social norms that people are supposed to follow in this country.') tight2 = make_field('In this country, there are very clear expectations for how people should act in most situations.') tight3 = make_field('People agree upon what behaviors are appropriate versus inappropriate in most situations this country.') tight4 = make_field('People in this country have a great deal of freedom in deciding how they want to behave in most situations.') tight5 = make_field('In this country, if someone acts in an inappropriate way, others will strongly disapprove.') tight6 = make_field('People in this country almost always comply with social norms.') image = make_field('It is important for me not to be perceived as selfish.') lie1 = make_field('I would lie if something important is at stake.') lie2 = make_field('It is acceptable to lie depending on the context.') lie3 = make_field('I would lie to protect my family.') lie4 = make_field('I would tell white lies (a white lie is a lie about a small or unimportant matter that is ' 'told to make someone happy).') lie5 = make_field('I would tell a harmless lie to fit in within my friend group.') lie6 = make_field('I would tell a harmless lie to save a friend from an embarrassing situation.') lie7 = make_field('I would sometimes lie by omission (by leaving out a detail or by not correcting ' 'someone’s false belief in something).') lie8 = make_field('If I know that learning the truth will hurt someone, I would (sometimes) avoid telling the truth to them.') lie9 = make_field('I would tell a harmless lie to avoid hurting someone’s feelings.') lie10 = make_field('I would lie about the traffic or something like that if I’m late to a formal meeting.') strategy = models.LongStringField(label='') question = models.LongStringField(label='') prolific = models.IntegerField( choices=[[0, 'No'], [1, 'Yes']], widget=widgets.RadioSelectHorizontal, label='', ) if_prolific = models.LongStringField(label='') uni_tr = models.IntegerField( choices=[[0, 'No'], [1, 'Yes']], widget=widgets.RadioSelectHorizontal, label='', ) uni_nl = models.IntegerField( choices=[[0, 'No'], [1, 'Yes']], widget=widgets.RadioSelectHorizontal, label='', ) uni_other = models.StringField(label='', blank=True) # FUNCTIONS # PAGES class StartSurvey(Page): pass class Per1(Page): form_model = 'player' form_fields = ['image', 'lie1', 'lie2', 'lie3', 'lie4'] class Per2(Page): form_model = 'player' form_fields = ['lie5', 'lie6', 'lie7', 'lie8', 'lie9', 'lie10'] class Demog(Page): form_model = 'player' @staticmethod def get_form_fields(self): if self.session.config['country'] == 'tr': return ['age', 'gender_tr', 'language', 'religious', 'political', 'study', 'uni_tr', 'uni_other'] else: return ['age', 'gender_tr', 'language', 'religious', 'political', 'study', 'uni_nl', 'uni_other'] def vars_for_template(self): return dict( country=self.session.config['country'], ) class IfRel(Page): form_model = 'player' form_fields = ['religion', 'religion_freq', 'religion_strength'] @staticmethod def is_displayed(player): return player.religious == 1 class Gelfand(Page): form_model = 'player' form_fields = ['tight1', 'tight2', 'tight3', 'tight4', 'tight5', 'tight6'] def vars_for_template(self): return dict( country=self.session.config['country'], ) class Crt(Page): form_model = 'player' form_fields = ['crt1', 'crt2', 'crt3', 'crt4'] class Str(Page): form_model = 'player' form_fields = ['strategy', 'question', 'prolific'] class IfProl(Page): form_model = 'player' form_fields = ['if_prolific'] @staticmethod def is_displayed(player): return player.prolific == 1 class Final(Page): def vars_for_template(self): return dict( participation_fee=self.session.config['participation_fee'], country=self.session.config['country'], ) page_sequence = [StartSurvey, Per1, Per2, Demog, IfRel, Gelfand, Crt, Str, IfProl, Final]