from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random from django import forms from django.utils.safestring import mark_safe from django.db.models import Case, Value, When from os import environ class Constants(BaseConstants): name_in_url = 'post_screen_survey' players_per_group = None num_rounds = 1 do_checks = environ.get('do_checks') class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def allowblank(): if C.DO_CHECKS: return False else: return True class Player(BasePlayer): feedback = models.LongStringField( label='Do you have any comments or feedback for the requester?', blank=True, widget=widgets.Textarea ) age = models.IntegerField( label='What is your age?', min=1, max=125, blank=allowblank() ) gender = models.StringField( choices=['Male', 'Female', 'Other'], label='What is your gender?', blank=allowblank() ) ethnicity = models.StringField( choices=['White', 'Hispanic, Latino, or Spanish', 'Black or African American', 'Asian', 'American Indian or Alaska Native', 'Middle Eastern or North African', 'Native Hawaiian or Other Pacific Islander', 'Other'], label='Ethnic origin: Which ethnicity best describes you.', blank=allowblank() ) highest_education = models.StringField( choices=['No schooling completed', 'Elementary School', 'Some high school, no diploma', 'High school graduate, diploma or the equivalent (for example: GED)', 'Some college credit, no degree', 'Trade/technical/vocational training', 'Associate degree', 'Bachelor’s degree', 'Master’s degree', 'Professional degree', 'Doctorate degree'], label='Education: What is the highest degree or level of school you have completed? If currently enrolled, ' 'highest degree received.', blank=allowblank() ) marital_status = models.StringField( choices=['Not Married', 'Married or Domestic Partnership', 'Widowed', 'Divorced'], label='Marital Status: What is your marital status?', blank=allowblank() ) employment_status = models.StringField( choices=['Employed for wages', 'Self-employed', 'Out of work and looking for work', 'Out of work but not currently looking for work', 'A homemaker', 'A student', 'Military', 'Retired', 'Unable to work', 'Other'], label='Employment Status: Are you currently…?', blank=allowblank() ) state =models.StringField( choices=['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Puerto Rico', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'Washington, D.C.', 'West Virginia', 'Wisconsin', 'Wyoming'], label='Which state or territory do you live in?', blank=allowblank() ) lib_con = models.IntegerField( choices=[(1,''),(2, ''),(3, ''),(4, ''),(5, ''),(6, ''),(7,'')], min=1, max=7, label='We hear a lot of talk these days about liberals and conservatives. Where would you place yourself on this scale?', widget=widgets.RadioSelectHorizontal, #(attrs={'choice_label': {1:'Extremely Liberal',7:'Extremely Conservative'}}) blank=allowblank() ) def make_field3(label): return models.IntegerField( choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, ''), (7, '')], label=label, widget=widgets.RadioSelect, blank=allowblank() ) Twitter = make_field3('Twitter') Instagram = make_field3('Instagram') Facebook = make_field3('Facebook') Snapchat = make_field3('Snapchat') LinkedIn = make_field3('LinkedIn') TikTok = make_field3('TikTok') def make_field4(label): return models.IntegerField( choices=[(1, ''), (2, ''), (3, ''), (4, ''), (5, ''), (6, ''), (7, '')], label=label, widget=widgets.RadioSelect, blank=allowblank() ) stayintouch = make_field4('Social networks are a great way for people to stay in touch with one another.') toomuchtime = make_field4('It consumes too much time to maintain and/or read social networking pages.') potentialemployers = make_field4('Potential and/or existing employers should use information found on social networking pages to make decisions about prospective and/or existing employees.') professional = make_field4('I think it is important to have a professional social media presence.') # privacy lostControl = make_field4('People have lost control over how personal information is collected and used by all kinds of entities.') advertisers = make_field4('I am concerned about advertisers and businesses accessing the data I share on social media platforms.') employers = make_field4('I am concerned about future and current employers accessing the data I share on social media platforms.') def make_field6(): return models.StringField( label='Comments', blank=True, widget=widgets.TextInput(attrs={'placeholder': "Optional Comment"}) ) def make_field8(label): return models.IntegerField( choices=[(1, ''), (0, '')], label=label, widget=widgets.RadioSelect, blank=allowblank() ) workExperienceInc = make_field8('work experience inconsistencies?') workExperienceIncText = make_field6() educationInc = make_field8('education and qualification inconsistencies?') educationIncText = make_field6() health = make_field8('health problems?') healthText = make_field6() crime = make_field8('criminal activity?') crimeText = make_field6() discrimination = make_field8('discriminatory behaviour?') discriminationText = make_field6() anythingElse = make_field8('anything else we should be aware of') anythingElseText = make_field6() def make_field5(label): return models.IntegerField( choices=[(10, ''), (9, ''), (8, ''), (7, ''), (6, ''), (5, ''), (4, ''), (3, ''), (2, ''), (1, '')], label=label, widget=widgets.RadioSelect, blank=allowblank() ) teams = make_field5('Teamwork') #'The ability to work effectively with others in teams') communicate = make_field5('Communication') #'The ability to effectively communicate') administration = make_field5('Administration')#'Administration and organisation skills') customerService = make_field5('Customer Service')# 'The ability to address customer needs and foster a positive experience') ITskills= make_field5('IT skills') experience = make_field5("Candidate's previous working experience") education = make_field5("Candidate's education") hobbies = make_field5("Candidate shows interests and hobbies outside of work") #CVpresentation = make_field5('How the candidate presents themselves on their resume') #SMpresentation = make_field5('How the candidate presents themselves on social media') CVcontents = make_field5("Contents of the candidate's resume") SMcontents = make_field5("Contents of the candidate's social media accounts") participant_vars_dump = models.StringField()