diff options
| author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2021-07-13 05:52:43 -0400 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-07-15 10:47:02 +0200 |
| commit | 08f077888548a951f01b454d0db08d9407f7f0aa (patch) | |
| tree | febcc5077fcbf96db706426d1fdd3a534812d943 /django/forms/forms.py | |
| parent | 90a33ab2ceddef7f2cdd11612f77ea9296cc7fb9 (diff) | |
Refs #32920 -- Added BoundField._has_changed() for use in BaseForm.changed_data().
Diffstat (limited to 'django/forms/forms.py')
| -rw-r--r-- | django/forms/forms.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index 40ed71ed5c..ac6ef667d9 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -203,9 +203,6 @@ class BaseForm: # widgets split data over several HTML fields. return widget.value_from_datadict(self.data, self.files, html_name) - def _field_data_value(self, field, html_name): - return self._widget_data_value(field.widget, html_name) - def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row): "Output HTML. Used by as_table(), as_ul(), as_p()." # Errors that should be displayed above all fields. @@ -439,26 +436,7 @@ class BaseForm: @cached_property def changed_data(self): - data = [] - for name, bf in self._bound_items(): - field = bf.field - if not field.show_hidden_initial: - # Use the BoundField's initial as this is the value passed to - # the widget. - initial_value = bf.initial - else: - hidden_widget = field.hidden_widget() - try: - initial_value = field.to_python( - self._widget_data_value(hidden_widget, bf.html_initial_name) - ) - except ValidationError: - # Always assume data has changed if validation fails. - data.append(name) - continue - if field.has_changed(initial_value, bf.data): - data.append(name) - return data + return [name for name, bf in self._bound_items() if bf._has_changed()] @property def media(self): |
