#26142 (Provide a way for model formsets to disallow new object creation) – Django (original) (raw)

#26142 closed New feature (fixed)

Reported by: Owned by: Vlad
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Model formsets don't provide a way to create an "edit only" view of objects. We see users trying to use extra=0 to accomplish this, but that's not reliable as extra is merely meant for the extra number of forms to display. You can add more forms with Javascript (or just send additional post data).

Attachments(1)

Change History(34)

comment:3 by Mathias Rav, 9 years ago

Owner: changed from nobody to Mathias Rav
Status: new → assigned

comment:5 by Tim Graham, 9 years ago

Yes, I think it's that sending data that references pks that don't appear in the queryset creates new objects for that data.

comment:8 by Parth Patil, 6 years ago

Owner: changed from Mathias Rav to Parth Patil

comment:11 by Mariusz Felisiak, 6 years ago

Needs documentation: set
Patch needs improvement: set

comment:12 by Jacob Walls, 4 years ago

Needs documentation: unset
Patch needs improvement: unset

comment:13 by Carlton Gibson, 4 years ago

Patch needs improvement: set

comment:14 by David Smith, 4 years ago

Easy pickings: set
Owner: Parth Patil removed
Status: assigned → new

comment:17 by Mariusz Felisiak, 4 years ago

Needs tests: set
Owner: set to Vlad
Patch needs improvement: set
Status: new → assigned

comment:18 by Vlad, 4 years ago

Needs tests: unset
Patch needs improvement: unset

comment:19 by Jacob Walls, 4 years ago

Patch still lacks a regression test that fails on main (upon removing the keyword introduced by the PR). Luckily, there is one we can use in the previous PR. Vlad, can you update your patch with additional tests from the previous PR?

comment:22 by Vlad, 4 years ago

Patch needs improvement: unset

I added *edit_only* argument for the modelfomset_factory and fixed tests as ​discussed with Jacob. Also, I documented changes for the modelformset_factory in release notes and topic about modelformsets.

comment:24 by Vlad, 4 years ago

Patch needs improvement: unset

Added edit_only argument to the formset_factory.

comment:25 by Mariusz Felisiak, 4 years ago

Needs documentation: set
Needs tests: set
Patch needs improvement: set

comment:26 by Vlad, 4 years ago

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Added argument for inlineformset_factory, tests for inlineformset_factory and formset_factory, changed docs and release notes

comment:28 by Vlad, 3 years ago

Needs documentation: unset

Added topic about edit_only mode in Formsets and fixed other remarks.

comment:30 by Vlad, 3 years ago

Needs documentation: unset

Fixed docs, where Sphinx raised warnings

comment:31 by Mariusz Felisiak, 3 years ago

Triage Stage: Accepted → Ready for checkin

comment:32 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: → fixed
Status: assigned → closed

Note: See TracTickets for help on using tickets.