Opened 11 years ago

Closed 11 years ago

#5857 closed (wontfix)

exclude_fields to pair with fields in form_for_model

Reported by: italomaia <italo.maia@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords: form_for_model enhancement
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


I was thinking, if there is the parameter "fields" with form_for_model, as a helper, it should existe something like exclude_fields,
because sometimes, one wants to hide from his form but one field. Doesn't seem "kind" to make a poor developer to
write a full set of fields just to "hide" a single one. Example:

class Example(models.Model):
    name = models.CharField(maxlength=20)
    name2 = models.CharField(maxlength=20)
    name3 = models.CharField(maxlength=20)
    show = models.BooleanField(default=True)

ExForm1 = form_for_model(Example, fields=('name1', 'name2', 'name3')) #exists
ExForm2 = form_for_model(Example, exclude_fields=('show')) #should exist
ExForm1 == ExForm2 -> True

-- Kind is good ^__^

Change History (2)

comment:1 Changed 11 years ago by Chris Beaven

Triage Stage: UnreviewedDesign decision needed

Proposal here:

Personally, I'm on the fence. While it's a nice mirror of fields, it's already possible with either a formfield_callback or by doing del ExForm2.base_fields['show'].

comment:2 Changed 11 years ago by Jacob

Resolution: wontfix
Status: newclosed

This is replaced by ModelForms, which will hit trunk shortly.

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