from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) GENDER_CHOICES = ( ('female', 'Female'), ('male', 'Male'), ('no_answer', 'Prefer not to answer'), ) EDUCATION_CHOICES = ( ('primary school', 'Primary School'), ('high school', 'High School'), ('bachelor', 'Bachelor\'s Degree'), ('master', 'Master\'s Degree'), ('phd', 'PhD'), ) YES_NO = ( ('yes','yes'), ('no','no') ) personal_info = { 'page_title': 'Demographic Questions', 'survey_fields': [ ('personal_info_age', { # field name 'text': 'Age', # survey question 'field': models.PositiveIntegerField(min=18, max=100), # the same as in normal oTree model field definitions }), ('personal_info_gender', { 'text': 'Gender', 'field': models.CharField(choices=GENDER_CHOICES), }), ('personal_info_education', { 'text': 'Last aquired education degree', 'field': models.CharField(choices=EDUCATION_CHOICES), }), ('personal_info_profession', { 'text': 'Occupation', 'field': models.CharField(), }), ('personal_info_vegan', { 'text': 'Do you follow a vegan diet?', 'field': models.CharField(choices=YES_NO), }), ('personal_info_allergy', { 'text': 'Do you have any food allergies?', 'field': models.CharField(), }) ] }