from otree.api import BasePlayer
from otree_tools.models import fields as tool_models
class Player(BasePlayer):
correct_statements = tool_models.MultipleChoiceModelField(label="Please select the three correct statements",
min_choices=3, max_choices=3)
在pages.py中:
^{pr2}$
在ExamplePage.html中,只需包含表单字段:
{% extends "global/Page.html" %}
{% load otree %}
{% block content %}
The following list of statements contains three correct statements and three false statements.
{% formfield player.correct_statements %}
{% next_button %}
{% endblock %}
为此,您可以使用
otree_models.models.MultipleChoiceFormField
,如下所示:在
models.py
中:在
^{pr2}$pages.py
中:在
ExamplePage.html
中,只需包含表单字段:相关问题 更多 >
编程相关推荐