diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 42d25fa..6296185 100644
a
|
b
|
class BaseFormSet(object):
|
123 | 123 | """ |
124 | 124 | Instantiates and returns the i-th form instance in a formset. |
125 | 125 | """ |
126 | | defaults = {'auto_id': self.auto_id, 'prefix': self.add_prefix(i)} |
| 126 | defaults = { |
| 127 | 'auto_id': self.auto_id, |
| 128 | 'prefix': self.add_prefix(i), |
| 129 | 'error_class': self.error_class, |
| 130 | } |
127 | 131 | if self.is_bound: |
128 | 132 | defaults['data'] = self.data |
129 | 133 | defaults['files'] = self.files |
diff --git a/tests/regressiontests/forms/tests/formsets.py b/tests/regressiontests/forms/tests/formsets.py
index 3decd1f..b3ceee5 100644
a
|
b
|
from __future__ import unicode_literals
|
3 | 3 | |
4 | 4 | from django.forms import Form, CharField, IntegerField, ValidationError, DateField |
5 | 5 | from django.forms.formsets import formset_factory, BaseFormSet |
| 6 | from django.forms.util import ErrorList |
6 | 7 | from django.test import TestCase |
7 | 8 | |
8 | 9 | |
… |
… |
class FormsFormsetTestCase(TestCase):
|
847 | 848 | self.assertTrue(formset) |
848 | 849 | |
849 | 850 | |
| 851 | def test_formset_error_class(self): |
| 852 | # Regression tests for #16479 -- formsets form use ErrorList instead of supplied error_class |
| 853 | class CustomErrorList(ErrorList): |
| 854 | pass |
| 855 | |
| 856 | formset = FavoriteDrinksFormSet(error_class=CustomErrorList) |
| 857 | self.assertEqual(formset.forms[0].error_class, CustomErrorList) |
| 858 | |
| 859 | |
850 | 860 | data = { |
851 | 861 | 'choices-TOTAL_FORMS': '1', # the number of forms rendered |
852 | 862 | 'choices-INITIAL_FORMS': '0', # the number of forms with initial data |