相关文章推荐
很拉风的鸭蛋  ·  RabbitMQ(六) -- ...·  1 年前    · 
玩篮球的甘蔗  ·  An Introduction to ...·  1 年前    · 
深沉的牙膏  ·  OpenCV中VideoCapture判断i ...·  1 年前    · 
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'])