#37026 new Bug

edit_only not implemented for formsets in GenericInlineModelAdmin

Reported by: Jacob Walls Owned by:
Component: contrib.contenttypes Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

BaseModelFormSet received an edit_only parameter in #26412 (and #33822), but it looks like this was never implemented for GenericInlineModelAdmin:

For the purposes of demonstrating the issue only, edit this test:

  • tests/generic_inline_admin/tests.py

    diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
    index b4833e54e7..9f1a997b00 100644
    a b class GenericInlineModelAdminTest(SimpleTestCase):  
    518518                return [(None, {"fields": ["url", "description"]})]
    519519
    520520        ma = MediaInline(Media, self.site)
    521         form = ma.get_formset(None).form
     521        form = ma.get_formset(None, edit_only=True).form
    522522        self.assertEqual(form._meta.fields, ["url", "description"])
    523523
    524524    def test_get_formsets_with_inlines_returns_tuples(self):
  File "/Users/jwalls/django/django/contrib/contenttypes/admin.py", line 150, in get_formset
    return generic_inlineformset_factory(self.model, **defaults)
TypeError: generic_inlineformset_factory() got an unexpected keyword argument 'edit_only'

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top