from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'demographics' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 ROLES_CHOICES = [ ['President', 'President'], ['Chief Academic Officer/Director', 'Chief Academic Officer/Director'], ['Chief Curriculum Officer/Director', 'Chief Curriculum Officer/Director'], ['Director of Curriculum, Instruction, and Assessment', 'Director of Curriculum, Instruction, and Assessment'], ['Assistant Superintendent of Curriculum', 'Assistant Superintendent of Curriculum'], ['Instructional Leader', 'Instructional Leader'], ['Principal', 'Principal'], ['Chief Technology Officer', 'Chief Technology Officer'], ['Technology Director', 'Technology Director'], ['Other', 'Other'], ] state_list = [ ['AL', 'Alabama'], ['AK', 'Alaska'], ['AZ', 'Arizona'], ['AR', 'Arkansas'], ['CA', 'California'], ['CO', 'Colorado'], ['CT', 'Connecticut'], ['DE', 'Delaware'], ['FL', 'Florida'], ['GA', 'Georgia'], ['HI', 'Hawaii'], ['ID', 'Idaho'], ['IL', 'Illinois'], ['IN', 'Indiana'], ['IA', 'Iowa'], ['KS', 'Kansas'], ['KY', 'Kentucky'], ['LA', 'Louisiana'], ['ME', 'Maine'], ['MD', 'Maryland'], ['MA', 'Massachusetts'], ['MI', 'Michigan'], ['MN', 'Minnesota'], ['MS', 'Mississippi'], ['MO', 'Missouri'], ['MT', 'Montana'], ['NE', 'Nebraska'], ['NV', 'Nevada'], ['NH', 'New Hampshire'], ['NJ', 'New Jersey'], ['NM', 'New Mexico'], ['NY', 'New York'], ['NC', 'North Carolina'], ['ND', 'North Dakota'], ['OH', 'Ohio'], ['OK', 'Oklahoma'], ['OR', 'Oregon'], ['PA', 'Pennsylvania'], ['RI', 'Rhode Island'], ['SC', 'South Carolina'], ['SD', 'South Dakota'], ['TN', 'Tennessee'], ['TX', 'Texas'], ['UT', 'Utah'], ['VT', 'Vermont'], ['VA', 'Virginia'], ['WA', 'Washington'], ['WV', 'West Virginia'], ['WI', 'Wisconsin'], ['WY', 'Wyoming'] ] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): State = models.StringField(choices = C.state_list, label="Where is your district located") size = models.StringField(choices=[["Less than 1000", "Less than 1000"], ["1000 to 2499", "1000 to 2499"], ["2500 to 4999", "2500 to 4999"], ["5000 to 7499", "5000 to 7499"], ["7500 to 10,000", "7500 to 10,000"], ["Greater than 10,000", "Greater than 10,000"]], label="What is the size of your district?") locality = models.StringField(choices=[ ["City", "City"], ["Suburban", "Suburban"], ["Town", "Town"], ["Rural", "Rural"] ], label="What is the locality of your district?", widget=widgets.RadioSelect) priority = models.StringField(choices=[ ["Prioritized by race", "More than 50% Black, Latinx, and/or English Learners"], ["Prioritized by FRPL", "More than 50% Free or Reduced-Price Lunch (FRPL)"], ["Prioritized by both", "Both of the above"], ["Non prioritized", "None of the above"] ], label="What are the demographics of the students in your district? ", widget=widgets.RadioSelect) age = models.IntegerField(label='What is your age', max=80, min=18) duration = models.IntegerField(label='How many years have you been in this role?', max=70, min=0) duration_education = models.IntegerField(label='How many years have you spent in the education field overall?', max=70, min=0) position = models.CharField( choices=C.ROLES_CHOICES, label='What is your role?', widget=widgets.RadioSelect ) other_role = models.CharField( label='Other (please specify)', blank=True) PL = models.IntegerField(label='Which year did you/your district last use external professional learning support?', max=2023, min=2000) Email = models.StringField(label='What is your professional email address (.edu)? This information will only be used to verify your responses, and will not be shared.') # PAGES class Demographics(Page): form_model = "player" form_fields = [ "State", "size", "locality", "priority", "age", "duration", "duration_education", "position", "other_role", "PL", "Email" ] def error_message(self, values): if values['age'] < 18 or values['age'] > 80: return 'Please enter a value between 18 and 80.' if values['duration'] < 0 or values['duration'] > 70: return 'Please enter a value between 0 and 70.' if values['duration_education'] < 0 or values['duration_education'] > 70: return 'Please enter a value between 0 and 70.' class Endofsurvey(Page): pass page_sequence = [Demographics,Endofsurvey]