Author: Honza_Kral
Date: 2009-06-01 10:41:15 -0500 (Mon, 01 Jun 2009)
New Revision: 10875
Modified:
django/branches/soc2009/model-validation/tests/regressiontests/inline_formsets/tests.py
Log:
[soc2009/model-validation] Corrected test for #10750
We don't need invalid formset (excluding required fields) in order to
test whether .save() is being called if commit=False
Modified:
django/branches/soc2009/model-validation/tests/regressiontests/inline_formsets/tests.py
===================================================================
---
django/branches/soc2009/model-validation/tests/regressiontests/inline_formsets/tests.py
2009-06-01 15:40:56 UTC (rev 10874)
+++
django/branches/soc2009/model-validation/tests/regressiontests/inline_formsets/tests.py
2009-06-01 15:41:15 UTC (rev 10875)
@@ -81,7 +81,7 @@
regression for #10750
"""
# exclude some required field from the forms
- ChildFormSet = inlineformset_factory(School, Child, exclude=['father',
'mother'])
+ ChildFormSet = inlineformset_factory(School, Child)
school = School.objects.create(name=u'test')
mother = Parent.objects.create(name=u'mother')
father = Parent.objects.create(name=u'father')
@@ -89,13 +89,13 @@
'child_set-TOTAL_FORMS': u'1',
'child_set-INITIAL_FORMS': u'0',
'child_set-0-name': u'child',
+ 'child_set-0-mother': unicode(mother.pk),
+ 'child_set-0-father': unicode(father.pk),
}
formset = ChildFormSet(data, instance=school)
self.assertEqual(formset.is_valid(), True)
objects = formset.save(commit=False)
- for obj in objects:
- obj.mother = mother
- obj.father = father
- obj.save()
+ self.assertEqual(school.child_set.count(), 0)
+ objects[0].save()
self.assertEqual(school.child_set.count(), 1)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---