diff options
| author | Ludovic Delaveau <ldelaveau@gmail.com> | 2012-10-04 09:24:23 -0400 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2012-10-13 15:28:20 +0100 |
| commit | 7a44dc555a3c9bfd1691ebb346b91f25d2f94c7d (patch) | |
| tree | fc8295b0aa4c8eead78c8e8cbdef08cd550a1759 /tests | |
| parent | cc83a4af0c51627bcdd566e4c01dcabcae51212c (diff) | |
Fixed #16479 - Forms generated from formsets use ErrorList instead of supplied error_class
Patch with tests from charettes, updated.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/forms/tests/formsets.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/tests/formsets.py b/tests/regressiontests/forms/tests/formsets.py index 3decd1f085..b3ceee551b 100644 --- a/tests/regressiontests/forms/tests/formsets.py +++ b/tests/regressiontests/forms/tests/formsets.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.forms import Form, CharField, IntegerField, ValidationError, DateField from django.forms.formsets import formset_factory, BaseFormSet +from django.forms.util import ErrorList from django.test import TestCase @@ -847,6 +848,15 @@ class FormsFormsetTestCase(TestCase): self.assertTrue(formset) + def test_formset_error_class(self): + # Regression tests for #16479 -- formsets form use ErrorList instead of supplied error_class + class CustomErrorList(ErrorList): + pass + + formset = FavoriteDrinksFormSet(error_class=CustomErrorList) + self.assertEqual(formset.forms[0].error_class, CustomErrorList) + + data = { 'choices-TOTAL_FORMS': '1', # the number of forms rendered 'choices-INITIAL_FORMS': '0', # the number of forms with initial data |
