diff options
Diffstat (limited to 'tests/regressiontests/model_fields/tests.py')
| -rw-r--r-- | tests/regressiontests/model_fields/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py index 2ac0af3267..d7591d5a22 100644 --- a/tests/regressiontests/model_fields/tests.py +++ b/tests/regressiontests/model_fields/tests.py @@ -26,6 +26,20 @@ if Image: TwoImageFieldTests +class BasicFieldTests(django.test.TestCase): + def test_show_hidden_initial(self): + """ + Regression test for #12913. Make sure fields with choices respect + show_hidden_initial as a kwarg to models.Field.formfield() + """ + choices = [(0, 0), (1, 1)] + model_field = models.Field(choices=choices) + form_field = model_field.formfield(show_hidden_initial=True) + self.assertTrue(form_field.show_hidden_initial) + + form_field = model_field.formfield(show_hidden_initial=False) + self.assertFalse(form_field.show_hidden_initial) + class DecimalFieldTests(django.test.TestCase): def test_to_python(self): f = models.DecimalField(max_digits=4, decimal_places=2) |
