from django import forms
class SignUpForm(forms.Form):
birth_day = forms.ChoiceField(choices=range(1,32))
我收到“渲染时捕获 TypeError:'int' 对象不可迭代”。 https://docs.djangoproject.com/en/dev/ref/models/fields/#field-choices表示选择参数采用列表或元组等可迭代对象。
http://docs.python.org/library/functions.html#range说 range() 创建一个列表。
为什么我会收到错误消息?
我尝试使用 map() 将列表转换为 str 但收到不同的错误。