diff --git a/tests/modeltests/model_formsets/tests.py b/tests/modeltests/model_formsets/tests.py
index 34f8d47..ee58702 100644
a
|
b
|
class ModelFormsetTest(TestCase):
|
353 | 353 | self.assertEqual(poet1.name, 'Vladimir Mayakovsky') |
354 | 354 | self.assertEqual(poet2.name, 'Vladimir Mayakovsky') |
355 | 355 | |
| 356 | def test_custom_form(self): |
| 357 | """ Test that model_formset respects fields and exclude parameters of |
| 358 | custom form |
| 359 | """ |
| 360 | class PostForm1(forms.ModelForm): |
| 361 | class Meta: |
| 362 | model = Post |
| 363 | fields = ('title', 'posted') |
| 364 | |
| 365 | class PostForm2(forms.ModelForm): |
| 366 | class Meta: |
| 367 | model = Post |
| 368 | exclude = ('subtitle',) |
| 369 | |
| 370 | PostFormSet = modelformset_factory(Post, form=PostForm1) |
| 371 | formset = PostFormSet() |
| 372 | self.assertFalse("subtitle" in formset.forms[0].fields) |
| 373 | |
| 374 | PostFormSet = modelformset_factory(Post, form=PostForm2) |
| 375 | formset = PostFormSet() |
| 376 | self.assertFalse("subtitle" in formset.forms[0].fields) |
| 377 | |
356 | 378 | def test_model_inheritance(self): |
357 | 379 | BetterAuthorFormSet = modelformset_factory(BetterAuthor) |
358 | 380 | formset = BetterAuthorFormSet() |