我正在尝试将个人放入表单字段的代码与我必须放入的代码列表进行比较,但出现下一个错误
Internal Server Error: /p/75spo3h2/beliefs/Code/1/
Traceback (most recent call last):
File "c:\users\diese\appdata\local\programs\python\python36\lib\site-
packages\otree\forms\forms.py", line 252, in _clean_fields
error_string = error_message_method(value)
File "C:\Users\diese\beliefs\beliefs\pages.py", line 15, in
number_error_message
if value[("numbers")] not in [int(1234, 3456, 6986)]:
TypeError: 'int' object is not subscriptable
ERROR Internal Server Error: /p/75spo3h2/beliefs/Code/1/
Traceback (most recent call last):
File "c:\users\diese\appdata\local\programs\python\python36\lib\site-
packages\otree\forms\forms.py", line 252, in _clean_fields
error_string = error_message_method(value)
File "C:\Users\diese\beliefs\beliefs\pages.py", line 15, in
number_error_message
if value[("numbers")] not in [int(1234, 3456, 6986)]:
TypeError: 'int' object is not subscriptable
我尝试将数字更改为 int 但效果不佳
class Code(Page):
form_model = 'player'
form_fields = ['number']
def number_error_message(self, value):
print('El número que pusiste es', value)
if value[("numbers")] not in [1234, 3456, 6986]:
return 'El código debe corresponder al código que se le entrego en la sesión 1'