Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#22628 closed Bug (fixed)

min_num on formsets should not just be added to extra.

Reported by: melinath Owned by: melinath
Component: Forms Version: 1.7-beta-2
Severity: Release blocker Keywords:
Cc: timo Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The current implementation is slightly broken.

I would set min_num=3 if there should be at least three things. I would set extra=3 if I wanted three blank forms presented.

The implementation that was added in 1.7 means that there will *always* be six blank forms - initial data is *not* taken into account.
To put it another way, if min_num is 3, and extra is 2, and there is initial data for two forms, I would expect to have either 4 forms (2 extra on top of existing objects) or 5 forms (2 extra on top of the minimum.) With the code as it is, I will instead get seven forms - two for the existing objects, and an additional seven from extra.

See note on #9532.

(Is this a release blocker, since it's a bug in a new feature?)

Change History (6)

comment:1 Changed 10 months ago by melinath

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to melinath
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 10 months ago by timo

  • Cc timo added
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 10 months ago by anonymous

Pull request: ticket/22628

comment:4 Changed 10 months ago by melinath

  • Has patch set

Forgot to log in. :-p

Last edited 10 months ago by melinath (previous) (diff)

comment:5 Changed 10 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 79f15ab1ef964c0209c4484ccf62ba458fd582b3:

[1.7.x] Fixed #22628 -- Took initial forms into account when combining FormSet.min_num and FormSet.extra.

comment:6 Changed 10 months ago by Tim Graham <timograham@…>

In d64f192df188903ea5a1ab8dfd6679e5d52aaf9b:

Fixed #22628 -- Took initial forms into account when combining FormSet.min_num and FormSet.extra.

Forwardport of 79f15ab1ef from stable/1.7.x

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