summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWindsooon <wiwindson@outlook.com>2017-07-12 14:11:44 -0400
committerTim Graham <timograham@gmail.com>2017-07-12 14:13:03 -0400
commite19b9d601574693e0b9d4769a9c9e4a4ed2fa01e (patch)
treebce4e4934b11646d047202e098955108f52e54d5
parent138a78ec8cab5e1df0c8ba2a3ee895cb756ff1ae (diff)
Merged nested if statements in BaseFormSet.is_valid().
-rw-r--r--django/forms/formsets.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 0531d50204..1c55d5f6df 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -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()