diff options
| author | Loic Bistuer <loic.bistuer@sixmedia.com> | 2013-07-31 12:50:39 +0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-02 10:41:29 -0400 |
| commit | a0ed2f9260f995b0cdf145f2802fc8123c25db65 (patch) | |
| tree | b72b155f386339569d58e13c870edac9a2cc1efe /tests/generic_inline_admin/tests.py | |
| parent | 920b242e307297778c6e5010f23502c4f41f299c (diff) | |
Fixed #18681 -- GenericInlineModelAdmin.get_formset() no longer bypasses get_fieldsets().
Refs 23e1b59 which already fixed this issue for ModelAdmin and InlineModelAdmin.
Diffstat (limited to 'tests/generic_inline_admin/tests.py')
| -rw-r--r-- | tests/generic_inline_admin/tests.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py index ccf12ab4f3..83bee2f4e0 100644 --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -325,3 +325,23 @@ class GenericInlineModelAdminTest(TestCase): self.assertEqual( list(list(ma.get_formsets(request))[0]().forms[0].fields), ['description', 'keywords', 'id', 'DELETE']) + + def test_get_fieldsets(self): + # Test that get_fieldsets is called when figuring out form fields. + # Refs #18681. + class MediaForm(ModelForm): + class Meta: + model = Media + fields = '__all__' + + class MediaInline(GenericTabularInline): + form = MediaForm + model = Media + can_delete = False + + def get_fieldsets(self, request, obj=None): + return [(None, {'fields': ['url', 'description']})] + + ma = MediaInline(Media, self.site) + form = ma.get_formset(None).form + self.assertEqual(form._meta.fields, ['url', 'description']) |
