diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-08-30 15:51:13 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-08-30 15:51:13 +0200 |
| commit | fb3d916c201d5882098bbcc94f60765412ba7aff (patch) | |
| tree | 6dc1669ceecdafd3efd4f6c0c25388613d1f2b85 /django/forms/formsets.py | |
| parent | ae88e73fa630694a152b54df68d53ce535312e45 (diff) | |
Fixed #18751 -- Cleaned up BaseFormSet._should_delete_form
We can do that now that cleaned_data is guaranteed to be
present. Related to [121fd109].
Thanks Simon Charette for his work on the ticket.
Diffstat (limited to 'django/forms/formsets.py')
| -rw-r--r-- | django/forms/formsets.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py index 1e8edfdb79..bdcef92dec 100644 --- a/django/forms/formsets.py +++ b/django/forms/formsets.py @@ -254,13 +254,10 @@ class BaseFormSet(object): errors = property(_get_errors) def _should_delete_form(self, form): - # The way we lookup the value of the deletion field here takes - # more code than we'd like, but the form's cleaned_data will - # not exist if the form is invalid. - field = form.fields[DELETION_FIELD_NAME] - raw_value = form._raw_value(DELETION_FIELD_NAME) - should_delete = field.clean(raw_value) - return should_delete + """ + Returns whether or not the form was marked for deletion. + """ + return form.cleaned_data.get(DELETION_FIELD_NAME, False) def is_valid(self): """ |
