我的选择如下,但我得到一个错误说明 选项必须是包含实际值和可读名称的可迭代
my model.py
class mymodel(models.Model):
MY_CHOICES =(
('corperation1','corperation'),
('Liablility2','Liablility'),
)
Company_type =
MultiSelectField(choices=MY_CHOICES,max_choices=1,max_length=2)
答案 0 :(得分:0)
class mymodel(models.Model):
company_type = models.CharField(max_length)
class myform(forms.ModelForm):
company_type = forms.MultipleChoiceField(choices = (('corperation1','corperation'),('Liablility2','Liablility')), widget = forms.MultiSelect())