Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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
Owner

This should provide a more expectable behavior.

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

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

A patch with tests is attached to the ticket.

Claude Paroz claudep closed this December 06, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jul 05, 2012
Simon Charette Fixed #18574 -- Make `BaseFormSet.is_valid` call it's underlying form…
…s' `is_valid`.

This should provide a more expectable behavior.
53a6cc8
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 3 deletions. Show diff stats Hide diff stats

  1. 5  django/forms/formsets.py
5  django/forms/formsets.py
@@ -259,7 +259,7 @@ def _should_delete_form(self, form):
259 259
 
260 260
     def is_valid(self):
261 261
         """
262  
-        Returns True if form.errors is empty for every form in self.forms.
  262
+        Returns True if every form in self.forms is valid.
263 263
         """
264 264
         if not self.is_bound:
265 265
             return False
@@ -274,8 +274,7 @@ def is_valid(self):
274 274
                     # This form is going to be deleted so any of its errors
275 275
                     # should not cause the entire formset to be invalid.
276 276
                     continue
277  
-            if bool(self.errors[i]):
278  
-                forms_valid = False
  277
+            forms_valid &= form.is_valid()
279 278
         return forms_valid and not bool(self.non_form_errors())
280 279
 
281 280
     def full_clean(self):
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.