from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) import random class Constants(BaseConstants): name_in_url = 'SubjectPool' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): id_sub = models.StringField() def set_id_sub(self): characters = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'x', 'Y', 'Z'] random.shuffle(characters) self.id_sub = str(characters[0] + characters[1] + characters[2] + characters[3] + characters[4] + characters[5]) infected = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='', widget=widgets.RadioSelectHorizontal ) lund = models.BooleanField( choices=[[True, 'Yes'], [False, 'No']], label='', widget=widgets.RadioSelectHorizontal ) first_name = models.StringField( label='', ) last_name = models.StringField( label='', ) gender = models.StringField( choices=['Female', 'Male', 'Other', 'Prefer not to answer'], label='', widget=widgets.RadioSelect ) stud_field = models.StringField( label='', ) email = models.StringField( label='', )