from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, ) author = 'Lilian Friedrich' doc = """ This is a questionnaire about socio-demographic characteristics of the participants """ class Constants(BaseConstants): name_in_url = 'Questionnaire' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_field(label): return models.IntegerField( label=label, choices=[ [1, "I strongly disagree"], [2, "I somewhat disagree"], [3, "I neither agree nor disagree"], [4, "I somewhat agree"], [5, "I strongly agree"], ], widget=widgets.RadioSelectHorizontal ) class Player(BasePlayer): teamCurrent = models.BooleanField( label="Are you currently working in a team?", choices=[ [True, 'Yes, I am.'], [False, 'No, I am not at the moment.'] ], widget=widgets.RadioSelectHorizontal, ) teamBefore = models.IntegerField( label="", min=0 ) teamEnjoy = make_field( label="I enjoy working in a team.", ) age = models.IntegerField( label="Please specify your age (e.g. 24):", min=10, max=99, ) gender = models.IntegerField( label="Please select your gender", choices=[ [0, 'female'], [1, 'male'], [2, 'diverse'], [3, 'prefer not to specify'], ], widget=widgets.RadioSelectHorizontal, ) # other1 = models.StringField( # label="other:", # blank=True, # ) nationality = models.StringField( label="Please write your country of citizenship in the box below. (e.g. Germany)", ) levelOfEducation = models.StringField( label="What is the highest degree or level of education you have completed?", choices=[ "less than High School diploma", "High School or equivalent", "Bachelor's degree (e.g. BA, BSc)", "Master's degree (e.g. MA, MS, MEd", "Doctorate (e.g. PhD, EdD, DBA)", "Other", ], ) # other2 = models.StringField( # label="other:", # blank=True, # ) employment = models.StringField( label="What is your current employment status?", choices=[ "Employed Full-time", "Employed part-time", "Unemployed", "Student", "Retired", "Self-Employed", "Unable to work", ] ) eMail = models.StringField( label="If you want to receive the results of this study, please provide your E-Mail address below.", blank=True, ) # def eMail_error_message(self, value): # if '@' in value: # pass # elif value is None: # pass # else: # return 'Please enter a valid E-Mail address.' comment = models.TextField( label="If you want to add anything, please enter a comment below.", blank=True, )