1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Forms in model formsets and inline formsets can now be deleted even if they don't validate. Related to #9587.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10283 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans
2009-03-31 19:55:20 +00:00
parent 98f5f68463
commit 15becf23a9
6 changed files with 191 additions and 15 deletions

View File

@@ -228,9 +228,8 @@ class BaseFormSet(StrAndUnicode):
# 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]
prefix = form.add_prefix(DELETION_FIELD_NAME)
value = field.widget.value_from_datadict(self.data, self.files, prefix)
should_delete = field.clean(value)
raw_value = form._raw_value(DELETION_FIELD_NAME)
should_delete = field.clean(raw_value)
if should_delete:
# This form is going to be deleted so any of its errors
# should not cause the entire formset to be invalid.