Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4867. FormSet.is_valid() now returns False when the FormSet is…

… not bound. Thanks John Shaffer.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ff2a2884a15ddd23d7414497341905c56023abac 1 parent 976acdc
@jkocherhans jkocherhans authored
4 django/newforms/
@@ -153,6 +153,8 @@ def add_prefix(self, index):
return '%s-%s' % (self.prefix, index)
def is_valid(self):
+ if not self.is_bound:
+ return False
return self._is_valid
@@ -175,4 +177,4 @@ def all_valid(formsets):
for formset in formsets:
if not formset.is_valid():
return False
- return True
+ return True
4 tests/regressiontests/forms/
@@ -48,6 +48,10 @@
>>> formset.cleaned_data
[{'votes': 100, 'choice': u'Calexico'}]
+If a FormSet was not passed any data, its is_valid method should return False.
+>>> formset = ChoiceFormSet()
+>>> formset.is_valid()
FormSet instances can also have an error attribute if validation failed for
any of the forms.
Please sign in to comment.
Something went wrong with that request. Please try again.