From 535809e12161d28dacaf5161436fc05a9bb064aa Mon Sep 17 00:00:00 2001 From: Moritz Sichert Date: Mon, 10 Aug 2015 10:55:49 +0200 Subject: Fixed #25294 -- Allowed custom BoundFields on forms. --- tests/forms_tests/tests/test_forms.py | 11 +++++++++++ 1 file changed, 11 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 ac96d775a2..d3618b1a8c 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -1903,6 +1903,17 @@ Password: f = SampleForm(data={'name': 'bar'}) self.assertIsInstance(force_text(f['name']), SafeData) + def test_custom_boundfield(self): + class CustomField(CharField): + def get_bound_field(self, form, name): + return (form, name) + + class SampleForm(Form): + name = CustomField() + + f = SampleForm() + self.assertEqual(f['name'], (f, 'name')) + def test_initial_datetime_values(self): now = datetime.datetime.now() # Nix microseconds (since they should be ignored). #22502 -- cgit v1.3