diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index f03c80f..4c13740 100644
a
|
b
|
class ModelFormBaseTest(TestCase):
|
549 | 549 | self.assertEqual(list(OrderFields2.base_fields), |
550 | 550 | ['slug', 'name']) |
551 | 551 | |
| 552 | def test_default_populated_on_optional_field(self): |
| 553 | class PubForm(forms.ModelForm): |
| 554 | mode = forms.CharField(max_length=255, required=False) |
| 555 | |
| 556 | class Meta: |
| 557 | model = PublicationDefaults |
| 558 | fields = ('mode',) |
| 559 | |
| 560 | mf = PubForm({}) |
| 561 | self.assertEqual(mf.errors, {}) |
| 562 | m = mf.save(commit=False) |
| 563 | self.assertEqual(m.mode, 'di') # from the model field default |
| 564 | |
552 | 565 | |
553 | 566 | class FieldOverridesByFormMetaForm(forms.ModelForm): |
554 | 567 | class Meta: |