from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'David Lucius' doc = """ created by: David Lucius (david.lucius@posteo.de) """ class Constants(BaseConstants): name_in_url = 'DEMOGRAPHICS' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def creating_session(self): if self.session.config['mailing_group'] == '': # Raise error: Room on oTree server not found raise Exception('Please enter a mailing group.') class Group(BaseGroup): pass class Player(BasePlayer): # Screen: Account SALT = models.StringField() EMAIL = models.StringField() PASSWORD = models.StringField() PASSWORD_2 = models.StringField() # Screen Demographics ENTREPRENEUR = models.IntegerField( label='Do you plan to become an entrepreneur within the next 5 years?', choices=[ [1, 'yes'], [0, 'no'], [2, 'maybe'] ], widget=widgets.RadioSelect ) # Screen: Demographics AGE = models.IntegerField( label='How old are you (in years)?', min=0, max=120 ) # Screen Demographics GENDER = models.StringField( label='What is your (legal) gender?', choices=[ ['m', 'male'], ['f', 'female'] ], widget=widgets.RadioSelect ) # Screen Demographics IS_BACHELOR = models.BooleanField( label='Do you already have a bachelor‘s degree?', choices=[ [True, 'yes'], [False, 'no'] ], widget=widgets.RadioSelect ) # Screen Demographics DISCIPLINE = models.IntegerField( label='What is your primary academic discipline? Choose one only.', choices=[ [1, 'business/economics'], [2, 'other social sciences'], [3, 'medicine'], [4, 'humanities'], [5, 'formal sciences (mathematics or computer sciences)'], [6, 'natural sciences (physics, chemistry, biology, or similar)'] ], widget=widgets.RadioSelect )