Opened 7 years ago

Closed 6 years ago

#8993 closed (wontfix)

Rendering formsets as tables with a row per form

Reported by: andrew.mcmurry@… Owned by: nobody
Component: Forms Version: master
Severity: Keywords: formsets
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In the default as_table method of formsets it states:

        # XXX: there is no semantic division between forms here, there
        # probably should be. It might make sense to render each form as a
        # table row with each field as a td.

The attached patch provides an 'as_table_wide' method, which does this. It calls an 'as_row' method on each form. This 'as_row' method is also supplied in the patch.

It is also useful to be able to easily include extra columns in the table, that are not form entries, but which depend on the form. This is especially true for model formsets, where the contents of the extra columns depends on the same model instance as the form, eg for fields of the model that may not change, but which should be displayed. This can be done by providing a form class with its own 'as_row' method, which modifies the standard one.

Attachments (1)

forms_formsets.diff (1.7 KB) - added by andrew.mcmurry@… 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by andrew.mcmurry@…

comment:1 Changed 7 years ago by kratorius

  • Component changed from Uncategorized to Forms
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by jacob

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

I don't think we need to proliferate as_* methods; that's what templates are for.

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