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 = 1 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 that relevant sections of my medical notes and* data collected during the study, " "may be looked at by individuals from The University of Warwick, from regulatory authorities " "(or from a relevant NHS Trust*), where it is relevant to my taking part in this study. " "I give permission for these individuals to have access to my data") consent4 = make_field("I am happy for my data to be used in future research.") consent5 = models.IntegerField( 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_Check = models.IntegerField(label="")