from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from django import forms from django.core.validators import MinLengthValidator from django.core.validators import RegexValidator author = 'Alexander Coutts, Boon Han Koh, Zahra Murad' doc = """ Feedback/Gender Experiment: Demographic Survey (All) """ class Constants(BaseConstants): name_in_url = 'fg_all_demographic' players_per_group = None num_rounds = 1 states = [ ['AK', 'AK (Alaska)'], ['AL', 'AL (Alabama)'], ['AR', 'AR (Arkansas)'], ['AS', 'AS (American Samoa)'], ['AZ', 'AZ (Arizona)'], ['CA', 'CA (California)'], ['CO', 'CO (Colorado)'], ['CT', 'CT (Connecticut)'], ['DC', 'DC (District of Columbia)'], ['DE', 'DE (Delaware)'], ['FL', 'FL (Florida)'], ['GA', 'GA (Georgia)'], ['GU', 'GU (Guam)'], ['HI', 'HI (Hawaii)'], ['IA', 'IA (Iowa)'], ['ID', 'ID (Idaho)'], ['IL', 'IL (Illinois)'], ['IN', 'IN (Indiana)'], ['KS', 'KS (Kansas)'], ['KY', 'KY (Kentucky)'], ['LA', 'LA (Louisiana)'], ['MA', 'MA (Massachusetts)'], ['MD', 'MD (Maryland)'], ['ME', 'ME (Maine)'], ['MI', 'MI (Michigan)'], ['MN', 'MN (Minnesota)'], ['MO', 'MO (Missouri)'], ['MP', 'MP (Northern Mariana Islands)'], ['MS', 'MS (Mississippi)'], ['MT', 'MT (Montana)'], ['NA', 'NA (National)'], ['NC', 'NC (North Carolina)'], ['ND', 'ND (North Dakota)'], ['NE', 'NE (Nebraska)'], ['NH', 'NH (New Hampshire)'], ['NJ', 'NJ (New Jersey)'], ['NM', 'NM (New Mexico)'], ['NV', 'NV (Nevada)'], ['NY', 'NY (New York)'], ['OH', 'OH (Ohio)'], ['OK', 'OK (Oklahoma)'], ['OR', 'OR (Oregon)'], ['PA', 'PA (Pennsylvania)'], ['PR', 'PR (Puerto Rico)'], ['RI', 'RI (Rhode Island)'], ['SC', 'SC (South Carolina)'], ['SD', 'SD (South Dakota)'], ['TN', 'TN (Tennessee)'], ['TX', 'TX (Texas)'], ['UT', 'UT (Utah)'], ['VA', 'VA (Virginia)'], ['VI', 'VI (Virgin Islands)'], ['VT', 'VT (Vermont)'], ['WA', 'WA (Washington)'], ['WI', 'WI (Wisconsin)'], ['WV', 'WV (West Virginia)'], ['WY', 'WY (Wyoming)'], ['OTHER', 'Other (please state below)'], ] reside_state_list = states.copy() grew_state_list = states.copy() grew_state_list.insert(0,['N/A', 'Did not spend first 18 years in US at all']) countries = [ ['US', 'United States of America'], ['AF', 'Afghanistan'], ['AL', 'Albania'], ['DZ', 'Algeria'], ['AD', 'Andorra'], ['AO', 'Angola'], ['AG', 'Antigua and Barbuda'], ['AR', 'Argentina'], ['AM', 'Armenia'], ['AU', 'Australia'], ['AT', 'Austria'], ['AZ', 'Azerbaijan'], ['BS', 'Bahamas'], ['BH', 'Bahrain'], ['BD', 'Bangladesh'], ['BB', 'Barbados'], ['BY', 'Belarus'], ['BE', 'Belgium'], ['BZ', 'Belize'], ['BJ', 'Benin'], ['BT', 'Bhutan'], ['BO', 'Bolivia (Plurinational State of)'], ['BA', 'Bosnia and Herzegovina'], ['BW', 'Botswana'], ['BR', 'Brazil'], ['BN', 'Brunei Darussalam'], ['BG', 'Bulgaria'], ['BF', 'Burkina Faso'], ['BI', 'Burundi'], ['CV', 'Cabo Verde'], ['KH', 'Cambodia'], ['CM', 'Cameroon'], ['CA', 'Canada'], ['CF', 'Central African Republic'], ['TD', 'Chad'], ['CL', 'Chile'], ['CN', 'China'], ['CO', 'Colombia'], ['KM', 'Comoros'], ['CG', 'Congo'], ['CK', 'Cook Islands'], ['CR', 'Costa Rica'], ['HR', 'Croatia'], ['CU', 'Cuba'], ['CY', 'Cyprus'], ['CZ', 'Czechia'], ['CI', 'Côte d\'Ivoire'], ['KP', 'Democratic People\'s Republic of Korea'], ['CD', 'Democratic Republic of the Congo'], ['DK', 'Denmark'], ['DJ', 'Djibouti'], ['DM', 'Dominica'], ['DO', 'Dominican Republic'], ['EC', 'Ecuador'], ['EG', 'Egypt'], ['SV', 'El Salvador'], ['GQ', 'Equatorial Guinea'], ['ER', 'Eritrea'], ['EE', 'Estonia'], ['SZ', 'Eswatini'], ['ET', 'Ethiopia'], ['FO', 'Faroe Islands'], ['FJ', 'Fiji'], ['FI', 'Finland'], ['FR', 'France'], ['GA', 'Gabon'], ['GM', 'Gambia'], ['GE', 'Georgia'], ['DE', 'Germany'], ['GH', 'Ghana'], ['GR', 'Greece'], ['GD', 'Grenada'], ['GT', 'Guatemala'], ['GN', 'Guinea'], ['GW', 'Guinea-Bissau'], ['GY', 'Guyana'], ['HT', 'Haiti'], ['HN', 'Honduras'], ['HU', 'Hungary'], ['IS', 'Iceland'], ['IN', 'India'], ['ID', 'Indonesia'], ['IR', 'Iran (Islamic Republic of)'], ['IQ', 'Iraq'], ['IE', 'Ireland'], ['IL', 'Israel'], ['IT', 'Italy'], ['JM', 'Jamaica'], ['JP', 'Japan'], ['JO', 'Jordan'], ['KZ', 'Kazakhstan'], ['KE', 'Kenya'], ['KI', 'Kiribati'], ['KW', 'Kuwait'], ['KG', 'Kyrgyzstan'], ['LA', 'Lao People\'s Democratic Republic'], ['LV', 'Latvia'], ['LB', 'Lebanon'], ['LS', 'Lesotho'], ['LR', 'Liberia'], ['LY', 'Libya'], ['LT', 'Lithuania'], ['LU', 'Luxembourg'], ['MG', 'Madagascar'], ['MW', 'Malawi'], ['MY', 'Malaysia'], ['MV', 'Maldives'], ['ML', 'Mali'], ['MT', 'Malta'], ['MH', 'Marshall Islands'], ['MR', 'Mauritania'], ['MU', 'Mauritius'], ['MX', 'Mexico'], ['FM', 'Micronesia (Federated States of)'], ['MC', 'Monaco'], ['MN', 'Mongolia'], ['ME', 'Montenegro'], ['MA', 'Morocco'], ['MZ', 'Mozambique'], ['MM', 'Myanmar'], ['NA', 'Namibia'], ['NR', 'Nauru'], ['NP', 'Nepal'], ['NL', 'Netherlands'], ['NZ', 'New Zealand'], ['NI', 'Nicaragua'], ['NE', 'Niger'], ['NG', 'Nigeria'], ['NU', 'Niue'], ['MK', 'North Macedonia'], ['NO', 'Norway'], ['OM', 'Oman'], ['PK', 'Pakistan'], ['PW', 'Palau'], ['PA', 'Panama'], ['PG', 'Papua New Guinea'], ['PY', 'Paraguay'], ['PE', 'Peru'], ['PH', 'Philippines'], ['PL', 'Poland'], ['PT', 'Portugal'], ['QA', 'Qatar'], ['KR', 'Republic of Korea'], ['MD', 'Republic of Moldova'], ['RO', 'Romania'], ['RU', 'Russian Federation'], ['RW', 'Rwanda'], ['KN', 'Saint Kitts and Nevis'], ['LC', 'Saint Lucia'], ['VC', 'Saint Vincent and the Grenadines'], ['WS', 'Samoa'], ['SM', 'San Marino'], ['ST', 'Sao Tome and Principe'], ['SA', 'Saudi Arabia'], ['SN', 'Senegal'], ['RS', 'Serbia'], ['SC', 'Seychelles'], ['SL', 'Sierra Leone'], ['SG', 'Singapore'], ['SK', 'Slovakia'], ['SI', 'Slovenia'], ['SB', 'Solomon Islands'], ['SO', 'Somalia'], ['ZA', 'South Africa'], ['SS', 'South Sudan'], ['ES', 'Spain'], ['LK', 'Sri Lanka'], ['SD', 'Sudan'], ['SR', 'Suriname'], ['SE', 'Sweden'], ['CH', 'Switzerland'], ['SY', 'Syrian Arab Republic'], ['TJ', 'Tajikistan'], ['TH', 'Thailand'], ['TL', 'Timor-Leste'], ['TG', 'Togo'], ['TK', 'Tokelau'], ['TO', 'Tonga'], ['TT', 'Trinidad and Tobago'], ['TN', 'Tunisia'], ['TR', 'Turkey'], ['TM', 'Turkmenistan'], ['TV', 'Tuvalu'], ['UG', 'Uganda'], ['UA', 'Ukraine'], ['AE', 'United Arab Emirates'], ['GB', 'United Kingdom of Great Britain and Northern Ireland'], ['TZ', 'United Republic of Tanzania'], ['UY', 'Uruguay'], ['UZ', 'Uzbekistan'], ['VU', 'Vanuatu'], ['VE', 'Venezuela (Bolivarian Republic of)'], ['VN', 'Viet Nam'], ['YE', 'Yemen'], ['ZM', 'Zambia'], ['ZW', 'Zimbabwe'], ['OTHER', 'Other (please state below)'], ] grew_country_list = countries.copy() class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): yearbirth = models.IntegerField( label="What is your year of birth?", min=1900, max=2005, ) quarterbirth = models.IntegerField( label="What is your month of birth?", choices=[ [1, 'Between January and March'], [2, 'Between April and June'], [3, 'Between July and September'], [4, 'Between October and December'], ] ) female = models.IntegerField( label="What is your gender?", choices=[ [0, 'Male'], [1, 'Female'], [-1, 'Trans/Intersex/Other'], ] ) ethnicity = models.StringField( label="What is your ethnicity?", choices=[ ['White', 'White/ Caucasian'], ['Black', 'Black/ African-American'], ['Hispanic', 'Latino or Hispanic'], ['Asian', 'Asian'], ['Native American', 'Native American'], ['Islander', 'Native Hawaiian or Pacific Islander'], ['Mixed', 'Mixed/ Multiple ethnic groups'], ['OTHER', 'Other ethnic group (please state below)'], ] ) other_ethnicity = models.StringField( label='', blank=True ) educ = models.IntegerField( label="What is the highest education qualification you have attained?", choices=[ [1, 'Did not complete High School'], [2, 'Graduated from High School'], [3, 'Some College'], [4, 'Bachelor’s Degree'], [5, 'Master’s Degree'], [6, 'Ph.D. or higher'], ] ) income = models.IntegerField( label="What is your household annual income?", choices=[ [1, 'Less than $20,000'], [2, '$20,000-$39,999'], [3, '$40,000-$59,999'], [4, '$60,000-$79,999'], [5, '$80,000-$99,999'], [6, '$100,000 or more'], ] ) residence_state = models.StringField( label="In which US state/territory do you currently live?", choices=reside_state_list ) other_residence_state = models.StringField( label='', blank=True ) grewup_country = models.StringField( label="In which country did you spend the most time for the first 18 years of your life?", choices=grew_country_list ) other_grewup_country = models.StringField( label='', blank=True ) grewup_state = models.StringField( label="In which US state/territory did you spend the most time for the first 18 years of your life?", choices=grew_state_list ) other_grewup_state = models.StringField( label='', blank=True ) social_liberal = models.IntegerField( label='On social issues how would you describe your political leaning among the following options?', choices=[ [0, 'Strongly conservative'], [1, 'Moderately conservative'], [2, 'Neither conservative nor liberal'], [3, 'Moderately liberal'], [4, 'Strongly liberal'], ] ) party_political = models.StringField( label='Generally speaking, do you usually think of yourself as a...', choices=[ 'Republican', 'Democrat', 'Independent', 'Other', ] ) fave_color = models.StringField( label="Of the following, which is your favorite color?", choices=[ 'Red', 'Green', 'Blue', 'Purple', ] ) fave_beverage = models.StringField( label="Of the following, which is your favorite choice of hot beverage?", choices=[ 'Coffee', 'Tea', 'Hot chocolate', ] )