from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'survey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass def make_field(label): return models.IntegerField( choices=[1,2,3,4,5], label=label, widget=widgets.RadioSelect, ) class Player(BasePlayer): q1 = make_field('Tends to find fault with others') q2 = make_field('Is helpful and unselfish with others') q3 = make_field('Starts quarrels with others') q4 = make_field('Has a forgiving nature') q5 = make_field('Is generally trusting') q6 = make_field('Can be cold and aloof') q7 = make_field('Is considerate and kind to almost everyone') q8 = make_field('Is sometimes rude to others') q9 = make_field('Likes to cooperate with others') q10 = make_field("People should be willing to help others who are less fortunate") q11 = make_field("People must take care of themselves and not overly worry about others") q12 = make_field("Personally assisting people in trouble is very important to me") education_level = models.StringField(label='What is your education level? Select the level you have completed', choices=['Did not complete high school', 'Completed high school', 'Completed undergraduate degree', 'Completed graduate/professional degree']) gender = models.StringField(label='What gender do you identify with?', choices=['Prefer not to answer', 'Man', 'Woman', 'Non-binary person', 'Not listed']) # PAGES class SurveyInstructions(Page): pass class SurveyQuestions1(Page): form_model = 'player' form_fields = ['q1','q2','q3','q4','q5','q6','q7','q8','q9',] class SurveyQuestions2(Page): form_model = 'player' form_fields = ['q10','q11','q12'] class SurveyQuestions3(Page): form_model = 'player' form_fields = ['education_level'] class SurveyQuestions4(Page): form_model = 'player' form_fields = ['gender'] class paymentinfo(Page): form_model = 'player' @staticmethod def js_vars(player): return dict( completionlink= player.subsession.session.config['completionlink'] ) pass class Results(Page): pass page_sequence = [SurveyInstructions, SurveyQuestions1, SurveyQuestions2, SurveyQuestions3, SurveyQuestions4, paymentinfo]