From 4df7e8483b2679fc1cba3410f08960bac6f51115 Mon Sep 17 00:00:00 2001 From: Paweł Marczewski Date: Sun, 24 May 2015 20:43:20 +0200 Subject: Fixed #24788 -- Allowed Forms to specify a prefix at the class level. --- tests/forms_tests/tests/test_forms.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/forms_tests') 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. -- cgit v1.3