from otree.api import * c = Currency # old name for currency; you can delete this. doc = """ this app contains the survey """ class Constants(BaseConstants): name_in_url = 'tradesurvey' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField(label='What is your age?', min=16, max=99) gender = models.IntegerField( choices=[[1, 'Male'], [2, 'Female'], [3, 'other']], label='What is your gender?', widget=widgets.RadioSelect) income = models.IntegerField(label='What is your annual household income in €?', choices=[[1, 'below 30,000'], [2, '30,000 - 39,999'], [3, '40,000 - 49,999'], [4, '50,000 - 59,999'], [5, '60,000 - 69,999'], [6, 'above 69,999'], [7, 'I do not know']], widget=widgets.RadioSelectHorizontal) education = models.IntegerField(label='What is the highest level of education you have achieved?', choices=[[1, 'some High School'], [2, 'High School'], [3, 'Bachelors Degree'], [4, 'Masters Degree'], [5, 'Doctorate Degree']]) employment = models.IntegerField(label='What describes your current employment status best?', choices=[[1, 'Full-Time employed'], [2, 'Part-Time employed'], [3, 'Unemployed'], [4, 'Student'], [5, 'Retired'], [6, 'Self-employed']]) political_views = models.IntegerField(label='Which of these best describes your political viewpoint?', choices=[[1, 'Very conservative'], [2, 'Slightly conservative'], [3, 'Slightly liberal'], [4, 'Very liberal'], [5, 'Prefer not to answer']]) freetrade = models.IntegerField(label='For your country, do you think free trade is', choices=[[1, 'always good'], [2, 'mostly good'], [3, 'sometimes good, sometimes bad'], [4, 'mostly bad'], [5, 'always bad']], widget=widgets.RadioSelectHorizontal) fairness = models.IntegerField(label='In your opinion the outcomes of free trade are', choices=[[1, 'very fair'], [2, 'slightly fair'], [3, 'neither fair, nor unfair'], [4, 'slightly unfair'], [5, 'very unfair']], widget=widgets.RadioSelectHorizontal) protection = models.BooleanField(label='Are there cases where you are supportive of protectionism?', choices=[[True, 'yes'], [False, 'no']]) protection_jobs = models.BooleanField(label='To save jobs', initial=False, blank=True, widget=widgets.CheckboxInput) protection_industry = models.BooleanField(label='To protect a certain industry or company', initial=False, blank=True, widget=widgets.CheckboxInput) protection_security = models.BooleanField(label='For national security reasons', initial=False, blank=True, widget=widgets.CheckboxInput) protection_text = models.StringField(blank=True, label='You can add you own here:') email = models.StringField(blank=True, label='Please leave your email address if you want to receive your payoff' ' via Amazon giftcard.') # FUNCTIONS # PAGES class Demographics(Page): form_model = 'player' form_fields = ['age', 'gender', 'income', 'education', 'employment', 'political_views'] class Questions(Page): form_model = 'player' form_fields = ['freetrade', 'fairness', 'protection'] class Protection(Page): form_model = 'player' form_fields = ['protection_jobs', 'protection_industry', 'protection_security', 'protection_text'] @staticmethod def is_displayed(player: Player): return player.protection class End(Page): form_model = 'player' form_fields = ['email'] page_sequence = [Demographics, Questions, Protection, End]