diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-03-07 01:50:58 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-03-07 01:50:58 +0000 |
| commit | 686dac03b7d6086730234512425f5e81baee7cbd (patch) | |
| tree | 5a0363552a81879a9b050f43236cd85895bdf698 /tests/regressiontests/model_fields | |
| parent | 9a67543c3e104c5d8212a6f9c94a43dde27cdb3d (diff) | |
Fixed #12913. Fields with choices now respect show_hidden_initial as a keyword argument to formfield. Thanks, semenov.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_fields')
| -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) |
