def save(self, commit=True): ans_list = [] for text in self.cleaned_data['answer']: ans = Answer() if self.submission: ans.submission = self.submission ans.question = self.question ans.value = text if commit: ans.save() ans_list.append(ans) return ans_list
def save(self, commit=True): if self.cleaned_data['answer'] is None: if self.fields['answer'].required: raise ValidationError, _('This field is required.') return ans = Answer() if self.submission: ans.submission = self.submission ans.question = self.question ans.value = self.cleaned_data['answer'] if commit: ans.save() return ans