Opened 7 years ago

Closed 7 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: UI/UX:

Description

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 7 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

Proposal here: http://groups.google.com/group/django-developers/browse_thread/thread/a22429616c10796d

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 7 years ago by jacob

  • Resolution set to wontfix
  • Status changed from new to closed

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

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