Code

Ticket #5524: ticket_5524__revision_6369.diff

File ticket_5524__revision_6369.diff, 903 bytes (added by __hawkeye__, 7 years ago)

cleaned_data is persisted for fields that do not have validation errors. (corrected typo in previous)

Line 
1Index: django/newforms/forms.py
2===================================================================
3--- django/newforms/forms.py    (revision 6369)
4+++ django/newforms/forms.py    (working copy)
5@@ -202,8 +202,6 @@
6             self.cleaned_data = self.clean()
7         except ValidationError, e:
8             self._errors[NON_FIELD_ERRORS] = e.messages
9-        if self._errors:
10-            delattr(self, 'cleaned_data')
11 
12     def clean(self):
13         """
14@@ -298,7 +296,7 @@
15         """
16         Returns the data for this BoundField, or None if it wasn't given.
17         """
18-        return self.field.widget.value_from_datadict(self.form.data, self.form.files, self.html_name)
19+        return self.form.cleaned_data.get(self.name, self.field.widget.value_from_datadict(self.form.data, self.form.files, self.html_name))
20     data = property(_data)
21 
22     def label_tag(self, contents=None, attrs=None):