添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
class EditProfileForm(ModelForm): interest = forms.MultipleChoiceField(required= False, widget = CheckboxSelectMultiple(), choices = CHECKBOX_CHOICES,) def save(self, *args, ** kwargs): u = self.instance.user u.interest = self.cleaned_data[ ' interest ' ] u.save() profile = super(EditProfileForm, self).save(*args,** kwargs) return profile

怎样得到如下数据呢

[u'value1', u'value2']
u.interest = u','.join(self.cleaned_data['interest'])