Opened 11 months ago

Closed 10 months ago

Last modified 10 months ago

#23307 closed Cleanup/optimization (fixed)

max_num limits total number of forms, not empty forms

Reported by: velle Owned by: Octowl
Component: Documentation Version: master
Severity: Normal Keywords: afraid-to-commit
Cc: cmawebsite@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

On: https://docs.djangoproject.com/en/1.6/topics/forms/formsets/

The documentation says: "The max_num parameter to formset_factory() gives you the ability to limit the maximum number of empty forms the formset will display".

I believe max_num limits the total number of forms, not the empty forms, or else the rest of the documentation on the page and the example do not make sense.

Also, right after the example they write: "If the value of max_num is greater than the number of existing objects, up to extra additional blank forms will be added to the formset, so long as the total number of forms does not exceed max_num."

They mention "objects". But if a newcomer to Django is reading the documentation on forms from one end to the other, he will not know what is meant by objects, when he hasnt yet read about ModelForms. I don't know how to deal with this. Maybe the ModelForm section could come before FormSet, but I have not thought that through.

Change History (11)

comment:1 Changed 11 months ago by collinanderson

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

It's true max_num limits the total number of forms, but it also allows you (with extra) to control the number of blank forms, but I agree it's a hair unclear.

Re objects: maybe rows or items? The example at the top simply uses an example article, even though it's not a model form.

Do you a clearer way to word these sentences?

comment:2 Changed 11 months ago by collinanderson

  • Cc cmawebsite@… added

comment:3 Changed 11 months ago by freakboy3742

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 10 months ago by evildmp

  • Keywords afraid-to-commit added
  • Version changed from 1.4 to master

I've marked this ticket as especially suitable for people following the ​Don't be afraid to commit tutorial at the DjangoCon US 2014 sprints.

If you're tackling this ticket, please don't hesitate to ask me for guidance if you'd like any, either at the sprints themselves, or here or on the Django IRC channels, where I can be found as EvilDMP.

comment:5 Changed 10 months ago by Octowl

  • Owner changed from nobody to Octowl
  • Status changed from new to assigned

I'm picking this up at the don't be afraid to commit workshop in the djangocon sprints

comment:6 Changed 10 months ago by Octowl

I am making changes in the following branch:

https://github.com/Octowl/django/tree/ticket_23307

comment:7 Changed 10 months ago by Octowl

comment:8 Changed 10 months ago by collinanderson

  • Has patch set

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

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

In 5f3806b8612efca45dba1a75b29ad1bbbc12a7ca:

Fixed #23307 -- Clarified the way max_num limits the output of formsets.

Thanks velle for the report.

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

In 731654197cfbc49296c0d5869aae698b315440e9:

[1.6.x] Fixed #23307 -- Clarified the way max_num limits the output of formsets.

Thanks velle for the report.

Backport of 5f3806b861 from master

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

In 813619405b4920c44f455b23ef407c6c66eb5746:

[1.7.x] Fixed #23307 -- Clarified the way max_num limits the output of formsets.

Thanks velle for the report.

Backport of 5f3806b861 from master

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