from otree.api import *
doc = """
Your app description
"""
class Constants(BaseConstants):
name_in_url = 'thanks'
players_per_group = None
num_rounds = 1
class Subsession(BaseSubsession):
pass
class Group(BaseGroup):
pass
class Player(BasePlayer):
email = models.StringField(
label = 'tu correo electrónico:'
)
celular =models.StringField(
label = 'y un número de telefono de referencia:'
)
callme =models.IntegerField(
label = '¿Como prefieres que nos comuniquemos contigo?',
choices = [
[1, "Mensaje de WhatsApp al número de referencia."],
[2, "Llamenme al número de referencia."],
[3, "Por correo electrónico."]
] ,
widget=widgets.RadioSelect()
)
# PAGES
class MyPage(Page):
form_model = 'player'
form_fields = ['email','celular','callme']
@staticmethod
def vars_for_template(player:Player):
price = player.participant.price
send = player.participant.send
remain = player.participant.remain
back = price - remain
theother = send*3
return dict(price=price, send=send,remain=remain, back=back, theother=theother)
page_sequence = [MyPage]