from otree.api import * from random import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'etude' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): Age=models.IntegerField(label="Indiquez votre âge") Sexe=models.IntegerField(label="Indiquez votre sexe",choices=[[1,"Homme"],[2,"Femme"],[3,"Ne pas spécifier"]]) CSP = models.IntegerField(label="Indiquez votre profession et catégorie socio-professionnelle", choices=[[1, "Agriculteurs exploitants"], [2, "Artisans, commerçants et chefs d'entreprise"], [3, "Cadres et professions intellectuelles supérieures"], [4, "Professions intermédiaires"], [5, "Employés"], [6, "Ouvriers"], [7, "Retraités"], [8, "Autres personnes sans activité professionnelle"],[9,"Etudiants"]]) Etude = models.StringField(label="Si vous êtes étudiant, merci d'indiquer votre domaine d'étude, sinon remplir ""Non""") # PAGES class Formulaire(Page): form_model = "player" form_fields = ["Age","Sexe","CSP","Etude"] class Regles(Page): @staticmethod def vars_for_template(player: Player): player.payoff=randint(0,100) player.participant.argent=player.payoff page_sequence = [Formulaire,Regles]