from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'intro_app' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Demographics age = models.IntegerField(label='What is your age?', min=18, max=125, choices=[[19, 'Under 20'], [20, '20-29'], [30, '30-39'], [40, '40-49'], [50, '50-59'], [60, '60-69'], [70, 'Over 70']]) gender = models.StringField( choices=[['Male', 'Male'], ['Female', 'Female'], ['Transgender', 'Transgender'], ['PNTS', 'Prefer not to say']], label='What is your gender?', widget=widgets.RadioSelect, ) nationality = models.StringField( choices=[['USA', 'USA'], ['Other', 'Other']], label='What is your nationality?', widget=widgets.RadioSelectHorizontal, ) race = models.StringField( choices=[['Asian', 'Asian'], ['Black', 'Black/African descent'], ['EastIndian', 'East Indian'], ['HispanicLatino', 'Hispanic/Latinx'], ['MiddleEastern', 'Middle Eastern'], ['NativeAmerican', 'Native American'], ['PacificIslander', 'Pacific Islander'], ['White', 'White/Caucasian'], ['Other', 'Other']], label="What is your race/ethnic group?", ) education = models.StringField( choices=[['LessThanHighSchool', 'Less than high school'], ['HighSchoolGrad', 'High school graduate/GED'], ['SomeCollege', 'Completed some college'], ['Associate', 'Associate\'s degree/two year college'], ['Bachelor', 'Bachelor\'s degree/four year college'], ['Master', 'Master\'s or professional degree'], ['Doctor', 'Doctoral degree'], ['Other', 'Other']], label='What is the highest degree or level of education you have completed?', ) employed = models.StringField( choices=[['PartTime', 'Yes - Part Time'], ['FullTime', 'Yes - Full Time'], ['Unemployed', 'No - Unemployed'], ['Retired', 'No - Retired']], label='Are you currently employed?', widget=widgets.RadioSelectHorizontal, ) occupation = models.StringField(label='What is your occupation?') yearsOfEmployment = models.IntegerField(label='How many years in total have you been working or have you worked?', min=0, max=100) income = models.CurrencyField( min=0, choices=[[9000, 'Less than $10,000'], [10000, '$10,000 - $19,000'], [20000, '$20,000 - $29,000'], [30000, '$30,000 - $39,000'], [40000, '$40,000 - $49,000'], [50000, '$50,000 - $59,000'], [60000, '$60,000 - $69,000'], [70000, '$70,000 - $79,000'], [80000, '$80,000 - $89,000'], [90000, '$90,000 - $99,000'], [100000, '$100,000 - $199,000'], [200000, '$200,000 - $299,000'], [300000, '$300,000 - $399,000'], [400000, '$400,000 - $499,000'], [500000, '$500,000 or over']]) pastDonationsMonthly = models.CurrencyField(label="How much do you typically donate to charity each month? " "If you usually make bulk contributions once in a year, enter the estimated value of your contribution divided by 12.", min=0) pastDonationsFreq = models.IntegerField(label="How many times have you donated to charity in the last 12 months?", min=0) otherPastDonationsMonthly = models.CurrencyField( label="Imagine someone you know who has donated to charity. About how much do you think that person typically donates each month?", min=0 ) otherPastDonationsFreq = models.IntegerField( label="About how many times do you think that person has donated to charity in the last 12 months?", min=0 ) treeAttentionCheck = models.IntegerField(label='Roughly how many trees are in this photo of a deciduous forest?', choices=[[99, '99 or fewer'], [100, '100'], [200, '200'], [300, '300'], [400, '400'], [401, '401 or more']], )