0
在我的應用程序,我需要的用戶失望list.I以爲我會創建一個對這篇如下Django的形式顯示一個下拉列表導致類型錯誤
class CIForm(forms.Form):
intervaloption = forms.ChoiceField(choices = [x for x in range(1,10)],label='Days taken')
然而,從下拉菜單中選擇一個整數值,當我試圖顯示此使用as_p()在Django殼,扔一個TypeError
In [29]: f= CIForm()
In [30]: f
Out[30]: <__main__.CIForm object at 0xaa93eec>
In [31]: print f.as_p()
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (41, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
...
TypeError: 'int' object is not iterable
我不能做什麼,我做錯了..can請你幫忙嗎?
非常感謝..我的錯不讀小心的文檔 – damon