diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py
index 81301cf..b025f5a 100644
a
|
b
|
def generic_inlineformset_factory(model, form=ModelForm,
|
362 | 362 | fields=None, exclude=None, |
363 | 363 | extra=3, can_order=False, can_delete=True, |
364 | 364 | max_num=None, |
365 | | formfield_callback=lambda f: f.formfield()): |
| 365 | formfield_callback=None): |
366 | 366 | """ |
367 | 367 | Returns an ``GenericInlineFormSet`` for the given kwargs. |
368 | 368 | |
diff --git a/tests/modeltests/generic_relations/tests.py b/tests/modeltests/generic_relations/tests.py
index 3d25301..a2bf3be 100644
a
|
b
|
|
| 1 | from django import forms |
1 | 2 | from django.contrib.contenttypes.generic import generic_inlineformset_factory |
2 | 3 | from django.contrib.contenttypes.models import ContentType |
3 | 4 | from django.test import TestCase |
… |
… |
class GenericRelationsTests(TestCase):
|
221 | 222 | formset = GenericFormSet(instance=lion, prefix='x') |
222 | 223 | self.assertEqual(u''.join(form.as_p() for form in formset.forms), u"""<p><label for="id_x-0-tag">Tag:</label> <input id="id_x-0-tag" type="text" name="x-0-tag" maxlength="50" /></p> |
223 | 224 | <p><label for="id_x-0-DELETE">Delete:</label> <input type="checkbox" name="x-0-DELETE" id="id_x-0-DELETE" /><input type="hidden" name="x-0-id" id="id_x-0-id" /></p>""") |
| 225 | |
| 226 | |
| 227 | class CustomWidget(forms.CharField): |
| 228 | pass |
| 229 | |
| 230 | class TaggedItemForm(forms.ModelForm): |
| 231 | class Meta: |
| 232 | model = TaggedItem |
| 233 | widgets = {'tag': CustomWidget} |
| 234 | |
| 235 | class GenericInlineFormsetTest(TestCase): |
| 236 | """ |
| 237 | Regression for #14572: Using base forms with widgets |
| 238 | defined in Meta should not raise errors. |
| 239 | """ |
| 240 | |
| 241 | def test_generic_inlineformset_factory(self): |
| 242 | Formset = generic_inlineformset_factory(TaggedItem, TaggedItemForm) |
| 243 | form = Formset().forms[0] |
| 244 | self.assertTrue(isinstance(form['tag'].field.widget, CustomWidget)) |