Simplify django.forms.formsets.all_valid() and clarify docstring
If in django.forms.formsets.all_valid() the calls to formset.is_valid() can be short-circuited, replace the body of the function with return all(formset.is_valid() for formset in formsets). Otherwise write as comment, that short-circuiting is not feasible and replace the if not formset.is_valid(): valid = False with valid &= formset.is_valid()
Change History
(4)
| Has patch: |
set
|
| Triage Stage: |
Unreviewed → Accepted
|
| Summary: |
django.forms.formsets.all_valid() short circuit → Simplify django.forms.formsets.all_valid() and clarify docstring
|
| Resolution: |
→ fixed
|
| Status: |
new → closed
|
Short-circuiting isn't valid because all formsets must be validated. I added a test for that in 4bcec02368b7e5466f64dc17286689b16613c94b.
PR to clarify the docstring and make the simplification.