Code

Opened 4 years ago

Closed 3 years ago

#12074 closed (fixed)

Added as_p and as_ul output for formsets.

Reported by: arthurdebert Owned by: nobody
Component: Forms Version: master
Severity: Keywords: formset template
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently a form can be rendered to html as tables, paragraphs and lists. Formsets can only be rendered to tables.

It's not a big deal, but the assymetry is confusing. The first thing I ever did with a formset was to use {{formset.as_p}} in a template, and get a blank output.
If there's a good reason not to allow for as_p and as_u for formsets, maybe the documentation should mention it.

Attachments (3)

django-formset-as_p-as_ul.diff (988 bytes) - added by arthurdebert 4 years ago.
formset-as_p-as_ul-with-tests.patch (3.1 KB) - added by dpn 4 years ago.
formset-as_p-as_ul-with-unittests.patch (3.9 KB) - added by dpn 4 years ago.

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by arthurdebert

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by gijs

line 306 in the patch includes 'form.as_table()' - 'this should be form.as_p()'

comment:3 Changed 4 years ago by dpn

  • Needs tests unset

Howdy,

Find attached a patch with as_table in as_p changed to as_p (as noted by @gijs).

The patch also contains doctests for as_table, as_p and as_ul.

Cheers.

Changed 4 years ago by dpn

comment:4 Changed 4 years ago by Alex

  • Triage Stage changed from Accepted to Ready for checkin

Looks good to me.

comment:5 Changed 3 years ago by Honza_Kral

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

(In [14250]) Fixed #12074 -- Adding .as_p and as_ul methods to FormSet. Thanks arthurdebert and dpn for the patch.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.