Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7899 closed (fixed)

Some small changes to FormSets

Reported by: Peter of the Norse <RahmCoff@…> 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.

  1. _max_form_count is renamed to max_form_count to make it constant with extra, etc.
  1. BaseInlineFormset now accepts prefix so that you can have more than one on a age.

Attachments (2)

formset.diff (3.9 KB ) - added by Peter of the Norse <RahmCoff@…> 16 years ago.
little diff
7899_tests.1.diff (724 bytes ) - added by Brian Rosner 16 years ago.
failing tests

Download all attachments as: .zip

Change History (10)

by Peter of the Norse <RahmCoff@…>, 16 years ago

Attachment: formset.diff added

little diff

comment:1 by Brian Rosner, 16 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 Brian Rosner, 16 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by Peter of the Norse <RahmCoff@…>, 16 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 Brian Rosner, 16 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 Brian Rosner, 16 years ago

Ugh, after reading the rest of your comment, I think I might step back and agree with you.

comment:6 by Brian Rosner, 16 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 Brian Rosner, 16 years ago

Resolution: fixed
Status: newclosed

(In [8060]) Added the ability to customize the prefix value on an inline formset. Fixes #7899. AThanks for the tip Peter of the Norse.

by Brian Rosner, 16 years ago

Attachment: 7899_tests.1.diff added

failing tests

comment:8 by Brian Rosner, 16 years ago

I posted the tests to the wrong window. Ignore ;)

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