diff options
| author | Kapil Garg <kapilgarg1996@gmail.com> | 2017-03-22 04:59:14 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-03-23 13:22:04 -0400 |
| commit | 7e09fa7f519daf2f9c26587c3da5dc044d84b032 (patch) | |
| tree | 290de61f86c654ce7b7ec8ec56906e1160eec77c /tests/model_fields | |
| parent | 075f13e44f203ee04f0c3abffc7d7a86c672cfe8 (diff) | |
Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices.
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 76b3e5596a..fc197cf0c4 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -54,6 +54,12 @@ class BasicFieldTests(TestCase): klass = forms.TypedMultipleChoiceField self.assertIsInstance(field.formfield(choices_form_class=klass), klass) + def test_formfield_disabled(self): + """Field.formfield() sets disabled for fields with choices.""" + field = models.CharField(choices=[('a', 'b')]) + form_field = field.formfield(disabled=True) + self.assertIs(form_field.disabled, True) + def test_field_str(self): f = models.Field() self.assertEqual(str(f), '<django.db.models.fields.Field>') |
