from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) from django.core import validators from django.utils import timezone from django import forms doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'Welcome' players_per_group = None num_rounds = 2 class Subsession(BaseSubsession): def creating_session(self): import itertools assign = itertools.cycle([True, False]) for player in self.get_players(): player.f_news = next(assign) class Group(BaseGroup): pass def make_field(label): return models.IntegerField( choices=[ [1, "Yes"], [2, "No"]], label=label, widget=widgets.RadioSelectHorizontal, blank=False ) class Player(BasePlayer): f_news = models.BooleanField() consent1 = make_field("I confirm that I have read and understand the information sheet for the above study. " "I have had the opportunity to consider the information, ask questions and have had these " "answered satisfactorily") consent2 = make_field("I understand that my participation is voluntary and that I am free to withdraw at any time " "without giving any reason, without my medical, social care, education, or legal rights* " "being affected") consent3 = make_field( "I understand and agree with the publication of the anonymized data. I am also informed that the anonymized " "data will be available on open access on Open Science Framework.") consent4 = make_field("I am happy for my data to be used in future research.") consent5 = models.IntegerField( label="Consent", choices=[ [0, "I have read the above and consent to take part in this study"], [1, "I do not wish to participate"]], blank=False, widget=widgets.RadioSelectHorizontal ) Date = models.StringField(label="Date", blank=False) Attention_Check1 = models.IntegerField(label= "Based on the text you read above, what colour have you been asked " "to enter?", choices=[ [1, "Red"], [2, "Green"], [3, "Blue"], [4, "Yellow"]], blank=False, widget=widgets.RadioSelect ) Attention_Check2 = models.IntegerField(label="Based on the text you read above, what colour have you been asked " "to enter?", choices=[ [1, "Red"], [2, "Green"], [3, "Blue"], [4, "Yellow"]], blank=False, widget=widgets.RadioSelect )