Manual example: http://docs.djangoproject.com/en/1.0/topics/forms/formsets/#formset-validation (I'm using Django 1.0.3 to run on Google App Engine)
Code:
from django import forms
from django.forms.formsets import formset_factory
class ArticleForm1(forms.Form):
title = forms.CharField()
pub_date = forms.DateField()
class ArticleForm2(forms.Form):
title = forms.CharField()
class ArticleForm3(forms.Form):
title = forms.CharField()
pub_date = forms.CharField()
ArticleFormSet1 = formset_factory(ArticleForm1)
ArticleFormSet2 = formset_factory(ArticleForm2)
ArticleFormSet3 = formset_factory(ArticleForm3)
data = {
'form-TOTAL_FORMS': u'2',
'form-INITIAL_FORMS': u'0',
'form-0-title': u'',
'form-0-pub_date': u'16 June 1904',
'form-1-title': u'', # <-- this title is missing but required
'form-1-pub_date': u'16 June 1904', # <-- this date is missing but required
}
formset = ArticleFormSet1(data)
print "Should be False: %s" % formset.is_valid()
formset = ArticleFormSet2(data)
print "Should be False: %s" % formset.is_valid()
formset = ArticleFormSet3(data)
print "Should be False: %s" % formset.is_valid()
Output:
$ .../ActiveStatePython2.5/python.exe formset_bug.py
Should be False: False
Should be False: True
Should be False: False
ActiveState Python 2.5.4.4, Django 1.0.3 final.
It looks as if it's not validating in the case of only one CharField (but 2 CharFields or a CharField and a DateField works).
I Googled for such a bug and couldn't find anything. I haven't yet tried Django 1.1, but it's much easier to use 1.0 on GAE for now.