Re: [Django] #9532: min_num on formsets

54 views
Skip to first unread message

Django

unread,
Dec 29, 2011, 2:45:04 PM12/29/11
to django-...@googlegroups.com
#9532: min_num on formsets
-------------------------------------+-------------------------------------
Reporter: gsf | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 0 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by tgecho):

* cc: tgecho (added)
* ui_ux: => 0
* easy: => 0


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

Django

unread,
Jan 15, 2012, 10:10:01 PM1/15/12
to django-...@googlegroups.com
#9532: min_num on formsets
-------------------------------------+-------------------------------------
Reporter: gsf | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 0 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ted.tieken@…):

* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:7>

Django

unread,
Sep 5, 2012, 2:59:14 PM9/5/12
to django-...@googlegroups.com
#9532: min_num on formsets
-------------------------------------+-------------------------------------
Reporter: gsf | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 0 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by kitsunde):

* cc: kitsunde@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:8>

Django

unread,
Sep 7, 2012, 7:14:12 AM9/7/12
to django-...@googlegroups.com
#9532: min_num on formsets
-------------------------------------+-------------------------------------
Reporter: gsf | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 1 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by thejaswi_puthraya):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:9>

Django

unread,
Jan 12, 2013, 6:06:22 AM1/12/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+------------------------------------

Reporter: gsf | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by claudep):

* stage: Design decision needed => Accepted


Comment:

#17642 has a patch to apply this feature to admin inlines.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:10>

Django

unread,
Jan 20, 2013, 11:24:17 AM1/20/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+------------------------------------
Reporter: gsf | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------

Comment (by wim@…):

Hi, probably it is a good idea to add min_num to modelformset_factory and
inlineformset_factory as well.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:11>

Django

unread,
Feb 23, 2013, 10:11:01 AM2/23/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+----------------------------------------
Reporter: gsf | Owner: AnkitBagaria
Type: New feature | Status: assigned

Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+----------------------------------------
Changes (by AnkitBagaria):

* owner: nobody => AnkitBagaria
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:12>

Django

unread,
Feb 23, 2013, 11:01:20 AM2/23/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+----------------------------------------
Reporter: gsf | Owner: AnkitBagaria
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+----------------------------------------

Comment (by tback):

Hi AnkitBagria, I just started working on this too. I'm in Utrecht right
now, I'm also in #django-sprint. My nick is tback.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:13>

Django

unread,
Feb 23, 2013, 12:03:33 PM2/23/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+----------------------------------------
Reporter: gsf | Owner: AnkitBagaria
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+----------------------------------------

Comment (by tback):

I think I fixed it. https://github.com/django/django/pull/784

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:14>

Django

unread,
Mar 7, 2013, 2:51:20 AM3/7/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+----------------------------------------
Reporter: gsf | Owner: AnkitBagaria
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+----------------------------------------

Comment (by tback):

Sorry, it's not fixed yet. BaseModelFormsets are still broken. The current
state of my work is here: https://github.com/tback/django/tree/formset-
min-num

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:15>

Django

unread,
Mar 9, 2013, 12:06:10 AM3/9/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+------------------------------------
Reporter: gsf | Owner:
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by AnkitBagaria):

* status: assigned => new
* owner: AnkitBagaria =>


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:16>

Django

unread,
Mar 9, 2013, 12:08:51 AM3/9/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+----------------------------------------
Reporter: gsf | Owner: AnkitBagaria
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+----------------------------------------
Changes (by AnkitBagaria):

* status: new => assigned
* owner: => AnkitBagaria


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:17>

Django

unread,
Mar 10, 2013, 8:56:29 AM3/10/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+------------------------------------
Reporter: gsf | Owner:
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by AnkitBagaria):

* status: assigned => new
* owner: AnkitBagaria =>


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:18>

Django

unread,
May 24, 2013, 12:50:43 AM5/24/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor

Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by yokomizor):

* owner: => yokomizor


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:19>

Django

unread,
May 24, 2013, 2:19:41 AM5/24/13
to django-...@googlegroups.com
#9532: min_num on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by yokomizor):

Please, check it out: https://github.com/django/django/pull/1208

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:20>

Django

unread,
Jul 12, 2013, 2:14:41 PM7/12/13
to django-...@googlegroups.com
#9532: Add min_num on formsets

-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by timo):

* cc: timograham@… (added)
* needs_better_patch: 0 => 1
* needs_docs: 0 => 1


Comment:

Thanks, the patch no longer merges cleanly so it needs to be rebased. It
also needs documentation including a mention in the 1.7 release notes. If
you could add that, I will try to review and commit it.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:21>

Django

unread,
Jul 25, 2013, 6:05:43 AM7/25/13
to django-...@googlegroups.com
#9532: Add min_num on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by mjtamlyn):

I'm pretty concerned about what the implementation for this looks like. It
seems to me that every formset on every Django site would now have to have
the extra "MIN" field. Whilst in theory this shouldn't break anyone's
sites, it will almost certainly break everyone's tests. I'd prefer a less
backwardsly problematic patch for a relatively minor feature.

That said, I think the feature is probably useful. Perhaps a patch could
be devised which means the "MAX" field is not required either?

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:22>

Django

unread,
Aug 6, 2013, 10:40:14 PM8/6/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets

-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by Rogério Yokomizo <me@…>):

* cc: me@… (added)


Comment:

Patch rebased.

Could someone please review?

https://github.com/django/django/pull/1444

About backward problematic, I don't know how can I do that. Any
suggestions?

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:23>

Django

unread,
Sep 18, 2013, 1:37:19 PM9/18/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by timo):

* needs_docs: 1 => 0


Comment:

I left comments on the pull request. I'm not sure there's actually any
backwards compatibility concerns as the parameters aren't actually
required in POST data as far as I can tell.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:24>

Django

unread,
Sep 19, 2013, 12:09:05 PM9/19/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: assigned
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by yokomizor):

Thanks timo!

I adjust the pull request based on your comments.

I rebased it. The old commit with comments can be seen at
https://github.com/yokomizor/django/commit/35d40939f89990c01f4c31ac10a29e3ec809d26e.

Could someone please review?

https://github.com/django/django/pull/1444

About the backward problematic, maybe the only backwards compatibility
concerns are in tests that test formset.as_X() return.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:25>

Django

unread,
Sep 19, 2013, 1:14:14 PM9/19/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"df27803a55ffea71d468a6aab0d897caa2b7a797"]:
{{{
#!CommitTicketReference repository=""
revision="df27803a55ffea71d468a6aab0d897caa2b7a797"
Fixed #9532 -- Added min_num and validate_min on formsets.

Thanks gsf for the suggestion.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:26>

Django

unread,
Sep 19, 2013, 1:21:56 PM9/19/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by timo):

It would also be useful to add this to `modelformset_factory`,
`inlineformset_factory`, etc. Ticket #17642 is open for that issue -- it
has a patch and the branch from tback above also looks relevant.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:27>

Django

unread,
Nov 24, 2013, 12:49:13 PM11/24/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by tchristiansen):

* cc: tchristiansen (added)


Comment:

Why is min_num added to extra?
This makes no sense to me, and makes extra useless in combination with
min_num.

extra=3 and min_num=3 resulting 6 forms, which is absolutely not what I
would expect (3 forms).

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:28>

Django

unread,
Nov 25, 2013, 9:12:22 AM11/25/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by yokomizor):

I think this is there because when you set min_num as 3 you want at least
3 extra forms.

Maybe we should remove it, or just clarify in the docs.

What about set extra equals to min_num when min_num is greater than extra?

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:29>

Django

unread,
Nov 29, 2013, 8:25:35 AM11/29/13
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by timo):

I agree a documentation improvement would be welcome.

@tchristiansen, is there a case you foresee where min_num=X and you
wouldn't want at least X extra forms?

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:30>

Django

unread,
May 13, 2014, 10:38:11 PM5/13/14
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by melinath):

@timo 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 here means that there will *always* be '''six''' blank
forms - existing objects are *not* taken into account.

To put it another way, if min_num is 3, and extra is 2, and there are
already 2 existing objects, 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.

Ran into this behavior while working on #17642. Possible this is only a
modelformset issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:31>

Django

unread,
May 14, 2014, 6:54:17 AM5/14/14
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by timo):

I agree existing objects should be taken into account so the number of
blank forms should be (min_num + extra - existing objects). Let's call it
a bug and fix it now.

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:32>

Django

unread,
May 14, 2014, 12:03:09 PM5/14/14
to django-...@googlegroups.com
#9532: Add min_num and validate_min on formsets
-----------------------------+-------------------------------------
Reporter: gsf | Owner: yokomizor
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by melinath):

Opened a new ticket for this: #22628

--
Ticket URL: <https://code.djangoproject.com/ticket/9532#comment:33>

Reply all
Reply to author
Forward
0 new messages