diff options
| author | Paweł Marczewski <pwmarcz@gmail.com> | 2015-05-24 20:43:20 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-05-25 20:23:31 -0400 |
| commit | 4df7e8483b2679fc1cba3410f08960bac6f51115 (patch) | |
| tree | bce0069d04c1c58aac1f44fefc81110f5bf0f8bf /tests/forms_tests | |
| parent | 4ccfc4439a7add24f8db4ef3960d02ef8ae09887 (diff) | |
Fixed #24788 -- Allowed Forms to specify a prefix at the class level.
Diffstat (limited to 'tests/forms_tests')
| -rw-r--r-- | tests/forms_tests/tests/test_forms.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 690f205680..e07fae22d1 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -1671,6 +1671,18 @@ class FormsTestCase(SimpleTestCase): self.assertEqual(p.cleaned_data['last_name'], 'Lennon') self.assertEqual(p.cleaned_data['birthday'], datetime.date(1940, 10, 9)) + def test_class_prefix(self): + # Prefix can be also specified at the class level. + class Person(Form): + first_name = CharField() + prefix = 'foo' + + p = Person() + self.assertEqual(p.prefix, 'foo') + + p = Person(prefix='bar') + self.assertEqual(p.prefix, 'bar') + def test_forms_with_null_boolean(self): # NullBooleanField is a bit of a special case because its presentation (widget) # is different than its data. This is handled transparently, though. |
