I'm using WTForms and I'm trying to display a SelectField
, but I get the following error:
>>> form.status()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\Lib\site-packages\wtforms\fields.py", line 136, in __call__
return self.widget(self, **kwargs)
File "C:\Python26\Lib\site-packages\wtforms\widgets.py", line 237, in __call__
for val, label, selected in field.iter_choices():
File "C:\Python26\Lib\site-packages\wtforms\fields.py", line 390, in iter_choices
for value, label in self.choices:
ValueError: too many values to unpack
Here's my form:
class TestForm(Form):
status = SelectField(u'Status', choices=Test.statuses())
The Test.statuses
static method returns a list of strings. What am I doing wrong?
It expects a list of
(str, str)
tuples, not a list of strings.Never mind, it needs tuples, not strings: