#37026: edit_only not implemented for formsets in GenericInlineModelAdmin
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  6.0
  contrib.contenttypes               |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sarah Boyce:

Old 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:
> {{{#!diff
> diff --git a/tests/generic_inline_admin/tests.py
> b/tests/generic_inline_admin/tests.py
> index b4833e54e7..9f1a997b00 100644
> --- a/tests/generic_inline_admin/tests.py
> +++ b/tests/generic_inline_admin/tests.py
> @@ -518,7 +518,7 @@ class GenericInlineModelAdminTest(SimpleTestCase):
>                  return [(None, {"fields": ["url", "description"]})]
>
>          ma = MediaInline(Media, self.site)
> -        form = ma.get_formset(None).form
> +        form = ma.get_formset(None, edit_only=True).form
>          self.assertEqual(form._meta.fields, ["url", "description"])
>
>      def test_get_formsets_with_inlines_returns_tuples(self):
> }}}
>
> {{{#!py
>   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'
> }}}

New description:

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

 For the purposes of demonstrating the issue only, edit this test:
 {{{#!diff
 diff --git a/tests/generic_inline_admin/tests.py
 b/tests/generic_inline_admin/tests.py
 index b4833e54e7..9f1a997b00 100644
 --- a/tests/generic_inline_admin/tests.py
 +++ b/tests/generic_inline_admin/tests.py
 @@ -518,7 +518,7 @@ class GenericInlineModelAdminTest(SimpleTestCase):
                  return [(None, {"fields": ["url", "description"]})]

          ma = MediaInline(Media, self.site)
 -        form = ma.get_formset(None).form
 +        form = ma.get_formset(None, edit_only=True).form
          self.assertEqual(form._meta.fields, ["url", "description"])

      def test_get_formsets_with_inlines_returns_tuples(self):
 }}}

 {{{#!py
   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'
 }}}

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37026#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d71bf534c-48caaf98-561b-4582-a7e4-3c5fa62cbcf8-000000%40eu-central-1.amazonses.com.

Reply via email to