#7899 closed (fixed)
Some small changes to FormSets
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Forms | Version: | dev | 
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
This diff file contains two minor changes to FormSets. 
_max_form_countis renamed tomax_form_countto make it constant withextra, etc.
BaseInlineFormsetnow acceptsprefixso that you can have more than one on a age.
Attachments (2)
Change History (10)
by , 17 years ago
| Attachment: | formset.diff added | 
|---|
comment:1 by , 17 years ago
Where is _max_form_count leaking to that is causing the inconsistence? The lack of prefix on BaseInlineFormset is a good catch. Ideally it was reported separately as we prefer individual tickets that describe a single problem.
comment:2 by , 17 years ago
| Triage Stage: | Unreviewed → Design decision needed | 
|---|
comment:3 by , 17 years ago
My reason for wanting _max_form_count changed was “I don’t use the factory functions and so I set it myself.” But as I sat down to justify it, I realized that there is more that should be changed. _max_form_count is the archetypical class value. It’s only used by __init__ and it doesn’t change between instances. In fact, it should be removed from ManagementForm entirely. The “MAX_FORM” value does nothing. And if people need the value in the template they can always use {{set.max_form_count}}.
I’ve updated the diff file, but I’ll wait to post it until a decision is made.
comment:4 by , 17 years ago
No, there is a reason for MAX_FORMS being in the ManagementForm. Javascript code that wants to dynamically create new forms on the fly will need it honor a maximum set by the application logic. I understand the reasoning you have and it really should just be renamed to max_num.
comment:5 by , 17 years ago
Ugh, after reading the rest of your comment, I think I might step back and agree with you.
comment:6 by , 17 years ago
(In [8058]) Made the semi-private _max_form_count live on the public API of formsets by renaming it to max_num. This also removes the ManagementForm use of MAX_COUNT since that usage should just be referenced to the formset's max_num property. Refs #7899. Thanks Peter of the Norse for straightening me out.
comment:7 by , 17 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
little diff