from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'my_simple_survey' PLAYERS_PER_GROUP = None NUM_ROUNDS = 2 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): """ I am defining models. Here, I will define the columns for the Player table in the database. I will add 2 fields: (1) name: StringField, that is, text characters (2) age: IntegerField, that is, a positive integer """ name = models.StringField() age = models.IntegerField() is_student = models.BooleanField() # PAGES """ This section is to define our pages, that is, we want it to contain the logic for how to display the HTML templates. Since we have 2 templates (MyPage and Results), we need 2 Page classes. The names for the classes need to be the same as for the html file they reger to. """ class MyPage(Page): """ This page contains a form, {{ formfields }}, so we need to define a form_model and form_fields """ form_model = 'player' form_fields = ['name', 'age', 'is_student'] class Results(Page): """ Since the results page does not have a form or any other special attributes, we just write "pass" """ pass class ResultsWaitPage(WaitPage): """ For this particular example, we could delete this page. For multi-player games, this page is a must """ pass """ Here we establish in which order we want the pages to show """ page_sequence = [ MyPage, Results ]