Ticket #5173: formsets-empty-forms-5897.diff
File formsets-empty-forms-5897.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/newforms/formsets.py
61 61 kwargs['files'] = self.files 62 62 add_form = FormClass(**kwargs) 63 63 self.add_fields(add_form, i) 64 # HACK: Form is empty, lets re-create without data so it doesn't trip validation 65 if add_form.is_empty(): 66 del(kwargs['data']) 67 add_form = FormClass(**kwargs) 68 self.add_fields(add_form, i) 64 69 add_forms.append(add_form) 65 70 self._add_forms = add_forms 66 71 return self._add_forms … … 69 74 def _get_change_forms(self): 70 75 """Return a list of all the change forms in this ``FormSet``.""" 71 76 FormClass = self.form_class 72 if not hasattr(self, '_ add_forms'):77 if not hasattr(self, '_change_forms'): 73 78 change_forms = [] 74 79 for i in range(0, self.change_form_count): 75 80 kwargs = {'auto_id': self.auto_id, 'prefix': self.add_prefix(i)}