# --------------------------------------------------------------------- # IMPORTS # --------------------------------------------------------------------- # from otree.api import * # We use explicit import instead of * in order to avoid import warnings from otree.api import models from otree.api import widgets from otree.api import Page from otree.api import WaitPage from otree.api import BaseConstants from otree.api import BaseSubsession from otree.api import BaseGroup from otree.api import BasePlayer # --------------------------------------------------------------------- # CLASSES # --------------------------------------------------------------------- class C(BaseConstants): NAME_IN_URL = 'demographics' # Define the players per group (since the value can be set dynamically within the settings.py we can keep it as none (should keep it as none)) PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Define the variables for the Demographics PCODE = models.StringField(label='Bitte geben Sie Ihre persönliche ID bestehend aus Ihren Initialen und Ihrem Geburtsjahr ein (z. B. EK1994)') age = models.IntegerField(label='Bitte geben Sie Ihr Alter in Jahren an', min=13, max=100) gender = models.StringField(choices=[['Männlich', 'Männlich'], ['Weiblich', 'Weiblich'], ['Divers', 'Divers']], label='Bitte geben Sie Ihre Geschlecht an.', widget=widgets.RadioSelect) education = models.StringField( choices=[['Mittelschule','Mittelschule'],['Matura','Matura'], ['Bachelor','Bachelor'], ['Master','Master'], ['Ph.D./Doktor','Ph.D./Doktor']], label = 'Was ist der höchste Bildungsabschluss den Sie bisher erreicht haben?', widget=widgets.RadioSelect) # --------------------------------------------------------------------- # CLASSES - PAGES # --------------------------------------------------------------------- ##EK: PAGES COMMUNICATE WITH THE HTML FILES class DemographicsPage(Page): form_model = 'player' form_fields = ['PCODE','age', 'gender', 'education'] timeout_seconds = 9999 class DemographicsWaitPage(WaitPage): pass # --------------------------------------------------------------------- # Define the order of the pages # --------------------------------------------------------------------- page_sequence = [DemographicsPage,DemographicsWaitPage,]