diff --git a/django/newforms/formsets.py b/django/newforms/formsets.py
index 2a0a131..3fac094 100644
a
|
b
|
class BaseFormSet(object):
|
93 | 93 | forms = property(_forms) |
94 | 94 | |
95 | 95 | def full_clean(self): |
96 | | """Cleans all of self.data and populates self.__errors and self.cleaned_data.""" |
| 96 | """Cleans all of self.data and populates self._is_valid and self.non_form_errors if applicable.""" |
97 | 97 | is_valid = True |
98 | | errors = [] |
| 98 | self.non_form_errors = [] |
99 | 99 | if not self.is_bound: # Stop further processing. |
100 | | self.__errors = errors |
101 | 100 | return |
102 | | cleaned_data = [] |
103 | | deleted_data = [] |
104 | 101 | |
105 | 102 | # Process change forms |
106 | 103 | for form in self.change_forms: |
107 | | if form.is_valid(): |
108 | | if self.deletable and form.cleaned_data[DELETION_FIELD_NAME]: |
109 | | deleted_data.append(form.cleaned_data) |
110 | | else: |
111 | | cleaned_data.append(form.cleaned_data) |
112 | | else: |
| 104 | if not form.is_valid(): |
113 | 105 | is_valid = False |
114 | | errors.append(form.errors) |
115 | 106 | |
116 | 107 | # Process add forms in reverse so we can easily tell when the remaining |
117 | 108 | # ones should be required. |
118 | 109 | required = False |
119 | | add_errors = [] |
120 | 110 | for i in range(len(self.add_forms)-1, -1, -1): |
121 | 111 | form = self.add_forms[i] |
122 | 112 | # If an add form is empty, reset it so it won't have any errors |
123 | 113 | if form.is_empty([ORDERING_FIELD_NAME]) and not required: |
124 | 114 | form.reset() |
125 | | continue |
126 | 115 | else: |
127 | 116 | required = True |
128 | | if form.is_valid(): |
129 | | cleaned_data.append(form.cleaned_data) |
130 | | else: |
| 117 | if not form.is_valid(): |
131 | 118 | is_valid = False |
132 | | add_errors.append(form.errors) |
133 | | add_errors.reverse() |
134 | | errors.extend(add_errors) |
135 | 119 | |
136 | | if self.orderable: |
137 | | cleaned_data.sort(lambda x,y: x[ORDERING_FIELD_NAME] - y[ORDERING_FIELD_NAME]) |
| 120 | try: |
| 121 | self.clean() |
| 122 | except ValidationError, e: |
| 123 | self.non_form_errors.extend(e.messages) |
| 124 | is_valid = False |
138 | 125 | |
139 | | if is_valid: |
140 | | self.cleaned_data = cleaned_data |
141 | | self.deleted_data = deleted_data |
142 | | self.errors = errors |
143 | 126 | self._is_valid = is_valid |
144 | 127 | |
| 128 | def has_errors(self): |
| 129 | return not self.is_valid() |
| 130 | |
| 131 | def clean(self): |
| 132 | pass |
| 133 | |
145 | 134 | def add_fields(self, form, index): |
146 | 135 | """A hook for adding extra fields on to each form instance.""" |
147 | 136 | if self.orderable: |