summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKapil Garg <kapilgarg1996@gmail.com>2017-03-22 04:59:14 +0530
committerTim Graham <timograham@gmail.com>2017-03-23 13:56:45 -0400
commita8c540accc7eb526e44ec2bc05881eb300f54530 (patch)
tree90b330205730cec1b5b78d3d69b2c61cd18f4807 /tests
parent37b28c9d7aab12e52c7f93fe91a3d357e669139e (diff)
[1.11.x] Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices.
Backport of 7e09fa7f519daf2f9c26587c3da5dc044d84b032 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/model_fields/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 5869196335..a9c9794a3c 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>')