Permalink
Browse files

Merged nested if statements in BaseFormSet.is_valid().

  • Loading branch information...
1 parent 138a78e commit e19b9d601574693e0b9d4769a9c9e4a4ed2fa01e @Windsooon Windsooon committed with timgraham Jul 12, 2017
Showing with 4 additions and 5 deletions.
  1. +4 −5 django/forms/formsets.py
View
@@ -301,11 +301,10 @@ def is_valid(self):
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()

0 comments on commit e19b9d6

Please sign in to comment.