I'd like to add an 'exclude_fields' keyword argument to form_for_model, etc. exclude_fields would be a list of field names that should be excluded from the form. If both 'fields' and 'exclude_fields' were passed in, exclude_fields would win for any field that existed in both lists. Any objections or issues that need further clarification?
I know the argument list for form_for_model is getting long, but excluding fields is just so damn useful ;)
> I'd like to add an 'exclude_fields' keyword argument to > form_for_model, etc. exclude_fields would be a list of field names > that should be excluded from the form.
Maybe you are already aware of this, but I believe you can exclude fields if you return None in the formfield callback. It's not as concise, but you can always create your own wrapper.
> -----Original Message----- > From: django-developers@googlegroups.com [mailto:django- > developers@googlegroups.com] On Behalf Of Joseph Kocherhans > Sent: Saturday, October 13, 2007 9:28 AM > To: django-developers@googlegroups.com > Subject: Proposal: form_for_model exclude_fields
> I'd like to add an 'exclude_fields' keyword argument to > form_for_model, etc. exclude_fields would be a list of field names > that should be excluded from the form. If both 'fields' and > 'exclude_fields' were passed in, exclude_fields would win for any > field that existed in both lists. Any objections or issues that need > further clarification?
> I know the argument list for form_for_model is getting long, but > excluding fields is just so damn useful ;)
On 10/13/07, Joseph Kocherhans <jkocherh...@gmail.com> wrote:
> I'd like to add an 'exclude_fields' keyword argument to > form_for_model, etc. exclude_fields would be a list of field names > that should be excluded from the form. If both 'fields' and > 'exclude_fields' were passed in, exclude_fields would win for any > field that existed in both lists. Any objections or issues that need > further clarification?
> I know the argument list for form_for_model is getting long, but > excluding fields is just so damn useful ;)
+1 from me. Personally, I'm in favour of making form_for_model as flexible as possible. 'exclude_fields' seems like a good move in that direction.
On Sun, 2007-10-14 at 20:47 +0800, Russell Keith-Magee wrote: > On 10/13/07, Joseph Kocherhans <jkocherh...@gmail.com> wrote:
> > I'd like to add an 'exclude_fields' keyword argument to > > form_for_model, etc. exclude_fields would be a list of field names > > that should be excluded from the form. If both 'fields' and > > 'exclude_fields' were passed in, exclude_fields would win for any > > field that existed in both lists. Any objections or issues that need > > further clarification?
> > I know the argument list for form_for_model is getting long, but > > excluding fields is just so damn useful ;)
> +1 from me. Personally, I'm in favour of making form_for_model as > flexible as possible. 'exclude_fields' seems like a good move in that > direction.
-0 from me. form_for_* are going down the same path as generic views where they are growing so many options the parameter list is becoming it's own little language and people are using it as a crutch for everything possible. You can already do this (via formfield_callback), so we're just adding a second way.
I suspect I've already lost the battle to keep these function as simple helpers, though, which is why I'm not -1.
Russell Keith-Magee wrote: > On 10/13/07, Joseph Kocherhans <jkocherh...@gmail.com> wrote: >> I know the argument list for form_for_model is getting long, but >> excluding fields is just so damn useful ;)
> +1 from me. Personally, I'm in favour of making form_for_model as > flexible as possible.
I would put myself in this boat as well. +1
> 'exclude_fields' seems like a good move in that > direction.
Excluding fields is probably the most common thing I do to customize forms.
> Russell Keith-Magee wrote: > > On 10/13/07, Joseph Kocherhans <jkocherh...@gmail.com> wrote: > >> I know the argument list for form_for_model is getting long, but > >> excluding fields is just so damn useful ;)
> > +1 from me. Personally, I'm in favour of making form_for_model as > > flexible as possible.
> I would put myself in this boat as well. +1
> > 'exclude_fields' seems like a good move in that > > direction.
> Excluding fields is probably the most common thing I do to customize forms.