0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Merged nested if statements in BaseFormSet.is_valid().

This commit is contained in:
Windsooon 2017-07-12 14:11:44 -04:00 committed by Tim Graham
parent 138a78ec8c
commit e19b9d6015

View File

@ -301,11 +301,10 @@ class BaseFormSet:
self.errors
for i in range(0, self.total_form_count()):
form = self.forms[i]
if self.can_delete:
if self._should_delete_form(form):
# This form is going to be deleted so any of its errors
# should not cause the entire formset to be invalid.
continue
if self.can_delete and self._should_delete_form(form):
# This form is going to be deleted so any of its errors
# shouldn't cause the entire formset to be invalid.
continue
forms_valid &= form.is_valid()
return forms_valid and not self.non_form_errors()