mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
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.
This commit is contained in:
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user