Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22628 closed Bug (fixed)

min_num on formsets should not just be added to extra.

Reported by: Stephen Burrows Owned by: Stephen Burrows
Component: Forms Version: 1.7-beta-2
Severity: Release blocker Keywords:
Cc: Tim Graham 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 by Stephen Burrows, 11 years ago

Owner: changed from nobody to Stephen Burrows
Status: newassigned

comment:2 by Tim Graham, 11 years ago

Cc: Tim Graham added
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:3 by anonymous, 11 years ago

Pull request: ticket/22628

comment:4 by Stephen Burrows, 11 years ago

Has patch: set

Forgot to log in. :-p

Last edited 11 years ago by Stephen Burrows (previous) (diff)

comment:5 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 79f15ab1ef964c0209c4484ccf62ba458fd582b3:

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

comment:6 by Tim Graham <timograham@…>, 11 years ago

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