diff options
| author | Maciej Jaworski <maciej.jaworski@tivix.com> | 2017-06-12 20:18:37 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-06-17 08:23:32 -0400 |
| commit | dc63ad7ac09ef694f19ae1d7496367614889e6fd (patch) | |
| tree | 1ee14846a870d76f5c03f61a27ce5d5e9785ee36 /tests | |
| parent | 3b050fd0d0b8dbf499bdb44ce12fa926298c0bd0 (diff) | |
Fixed #28319 -- Made TextField with choices use a Select widget.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/model_fields/test_textfield.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/model_fields/test_textfield.py b/tests/model_fields/test_textfield.py index a759b64648..82e7af8fd5 100644 --- a/tests/model_fields/test_textfield.py +++ b/tests/model_fields/test_textfield.py @@ -1,5 +1,6 @@ from unittest import skipIf +from django import forms from django.db import connection, models from django.test import TestCase @@ -18,6 +19,11 @@ class TextFieldTests(TestCase): self.assertIsNone(tf1.formfield().max_length) self.assertEqual(2345, tf2.formfield().max_length) + def test_choices_generates_select_widget(self): + """A TextField with choices uses a Select widget.""" + f = models.TextField(choices=[('A', 'A'), ('B', 'B')]) + self.assertIsInstance(f.formfield().widget, forms.Select) + def test_to_python(self): """TextField.to_python() should return a string.""" f = models.TextField() |
