from otree.api import * import itertools doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'newsurvey' players_per_group = None num_rounds = 1 endowment = 10 class Subsession(BaseSubsession): def creating_sessions(subsession): treatments = itertools.cycle(['WithoutMobility', 'IntermediateMobility', 'FullMobility']) for player in subsession.get_players(): player.treatment = next(treatments) class Group(BaseGroup): pass class Player(BasePlayer): treatment = models.StringField() contribution = models.IntegerField( min=0, max=Constants.endowment, label="How much would you contribute if you were Individual A?" ) belief = models.IntegerField( min=0, max=Constants.endowment, label="How much do you think that Individuals B predicted as " "the amount that Individuals A give, on average, at t = 1?" ) # This is for main choices, each variable is one row in the choice table MPL HL_1 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_2 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_3 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_4 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_5 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_6 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_7 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_8 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_9 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_10 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) HL_11 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) # This is needed for the instructions H_1 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_2 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_3 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_4 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_5 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_6 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_7 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_8 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_9 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_10 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) H_11 = models.PositiveIntegerField(choices=[[1, '

Very Socially Inappropriate

'], [2, '

Somewhat Socially Inappropriate

'], [3, '

Somewhat Socially Appropriate

'], [4, '

Very Socially Appropriate

']], widget=widgets.RadioSelectHorizontal) # # These variables are collected in the final questionnaire sex = models.StringField(widget=widgets.RadioSelectHorizontal(), choices=['Male', 'Female']) age = models.IntegerField(choices=range(18, 60, 1)) comment = models.TextField(label="If you had any difficulty or you have any comment write it here!") # PAGES class ConsentForm(Page): form_model = 'player' class SituationDescription(Page): form_model = 'player' def vars_for_template(player): a = player.treatment return dict( a = a ) class Instructions3(Page): form_model = 'player' form_fields = ['HL_1', 'HL_2', 'HL_3', 'HL_4', 'HL_5', 'HL_6', 'HL_7', 'HL_8', 'HL_9', 'HL_10', 'HL_11'] # the demo MPL class Instructions4(Page): form_model = 'player' form_fields = ['H_1', 'H_2', 'H_3', 'H_4', 'H_5', 'H_6', 'H_7', 'H_8', 'H_9', 'H_10', 'H_11'] # the demo MPL class Contribution1(Page): form_model = 'player' form_fields = ['contribution'] # the demo MPL def vars_for_template(player): treatment = player.treatment return dict( treatment=treatment ) class Contribution2(Page): form_model = 'player' form_fields = ['belief'] # the demo MPL def vars_for_template(player): treatment = player.treatment return dict( treatment=treatment ) class ElicitationNorms(Page): # which forms are needed from class player form_model = 'player' form_fields = ['HL_1', 'HL_2', 'HL_3', 'HL_4', 'HL_5', 'HL_6', 'HL_7', 'HL_8', 'HL_9', 'HL_10', 'HL_11'] # all 10 options class PageHL(Page): # which forms are needed from class player form_model = 'player' class Instructions1(Page): # which forms are needed from class player form_model = 'player' class ExampleSituation(Page): # which forms are needed from class player form_model = 'player' class ExampleSituation2(Page): # which forms are needed from class player form_model = 'player' class FinalInstructions(Page): # which forms are needed from class player form_model = 'player' class Questionnaire(Page): # forms to retrieve individual information form_model = 'player' form_fields = ['comment', 'sex', 'age'] page_sequence = [ConsentForm, Instructions1, ExampleSituation, ExampleSituation2, FinalInstructions, SituationDescription, ElicitationNorms, Contribution1, Contribution2, Questionnaire]