これを作ります
models.py
models.LongStringField() を使えば長い記述欄に、
StringField()を使えば短い記述欄になります。
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
class Constants(BaseConstants):
name_in_url = 'questionnaire'
players_per_group = None
num_rounds = 1
class Subsession(BaseSubsession):
pass
class Group(BaseGroup):
pass
class Player(BasePlayer):
def set_payoff(self):
self.payoff = 0
comment = models.LongStringField(initial=None,
verbose_name='実験について感想やコメントがあれば、ご自由にお書きください。')
templates (htmlファイル)
{% extends "global/Base.html" %}
{% load staticfiles otree_tags %}
{% block title %}
感想・コメント
{% endblock %}
{% block content %}
{% formfield player.comment %}
{% next_button %}
{% endblock %}
</script>
pages.py
from . import models
from ._builtin import Page, WaitPage
from otree.api import Currency as c, currency_range
from .models import Constants
class Page1(Page):
form_model = models.Player
form_fields = ['comment']
page_sequence = [
Page1
]
コメント