Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed #18574 -- Make `BaseFormSet.is_valid` call it's underlying forms'`is_valid` #186

Closed
wants to merge 1 commit into from

2 participants

Simon Charette Claude Paroz
Simon Charette
Collaborator

This should provide a more expectable behavior.

Simon Charette charettes Fixed #18574 -- Make `BaseFormSet.is_valid` call it's underlying form…
…s' `is_valid`.

This should provide a more expectable behavior.
53a6cc8
Claude Paroz
Collaborator

A patch with tests is attached to the ticket.

Claude Paroz claudep closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. Simon Charette

    Fixed #18574 -- Make `BaseFormSet.is_valid` call it's underlying form…

    charettes authored
    …s' `is_valid`.
    
    This should provide a more expectable behavior.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 3 deletions.
  1. +2 −3 django/forms/formsets.py
5 django/forms/formsets.py
View
@@ -259,7 +259,7 @@ def _should_delete_form(self, form):
def is_valid(self):
"""
- Returns True if form.errors is empty for every form in self.forms.
+ Returns True if every form in self.forms is valid.
"""
if not self.is_bound:
return False
@@ -274,8 +274,7 @@ def is_valid(self):
# This form is going to be deleted so any of its errors
# should not cause the entire formset to be invalid.
continue
- if bool(self.errors[i]):
- forms_valid = False
+ forms_valid &= form.is_valid()
return forms_valid and not bool(self.non_form_errors())
def full_clean(self):
Something went wrong with that request. Please try again.