summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHonza Král <Honza.Kral@gmail.com>2013-02-23 12:45:39 -0800
committerHonza Král <Honza.Kral@gmail.com>2013-02-23 12:45:39 -0800
commit10026c2ad0da99591567ba13afe4b489e050ca4a (patch)
treeaf65703760cfef5b6b0a965a94e3a0e87233fb07 /tests
parent24a2bcbcdd9e76901cd8f8bb38d9d5b6e0bc4fd6 (diff)
parentb6f4a92ff45d98a63dc29402d8ad86b88e6a6697 (diff)
Merge pull request #804 from oinopion/ticket18162
Fixes #18162 -- Specifying choices to Field overrides any form_class argument
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/model_fields/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py
index a49894e36c..8c596ed4f5 100644
--- a/tests/regressiontests/model_fields/tests.py
+++ b/tests/regressiontests/model_fields/tests.py
@@ -73,6 +73,16 @@ class BasicFieldTests(test.TestCase):
self.assertEqual(m._meta.get_field('id').verbose_name, 'verbose pk')
+ def test_formclass_with_choices(self):
+ # regression for 18162
+ class CustomChoiceField(forms.TypedChoiceField):
+ pass
+ choices = [('a@b.cc', 'a@b.cc'), ('b@b.cc', 'b@b.cc')]
+ field = models.CharField(choices=choices)
+ klass = CustomChoiceField
+ self.assertIsInstance(field.formfield(form_class=klass), klass)
+
+
class DecimalFieldTests(test.TestCase):
def test_to_python(self):
f = models.DecimalField(max_digits=4, decimal_places=2)