diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-03-07 01:52:48 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-03-07 01:52:48 +0000 |
| commit | e8c768910afd441aa39759de27939eee5d141219 (patch) | |
| tree | d0dcd22de5af814557ce0dfb961a953ab4dc9a12 /tests/regressiontests/model_fields | |
| parent | 8a8366d2faf2de41ac3072f80fd522dc273cf381 (diff) | |
[1.1.X] Fixed #12913. Fields with choices now respect show_hidden_initial as a keyword argument to formfield. Backport of r12696 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12697 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 29b4af50b7..53659db8ca 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) |
