Opened 17 years ago

Closed 17 years ago

#4785 closed (duplicate)

Widgets have nonconfigurable hardcoded HTML

Reported by: Michal Ludvig <michal@…> Owned by: nobody
Component: Forms Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Widgets CheckboxSelectMultiple and RadioFieldRenderer have hardcoded <ul><li>...</li></ul> tags which makes them hard to use in a design that expects different style of output, for instance wrapping things in <div></div> tags.

Attached patch takes these <ul> and <li> tags out of the code to a class variable that can be easily overwritten in subclasses. Creating a widget DivCheckboxSelectMultiple is then as simple as:

class DivCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):

tags = { 'block' : u'<div>%s</div>', 'item' : u'<div><label>%(label)s %(input)s</label></div>' }

Attachments (1)

div-widgets.diff (2.3 KB ) - added by Michal Ludvig <michal@…> 17 years ago.
Proposed patch

Download all attachments as: .zip

Change History (4)

by Michal Ludvig <michal@…>, 17 years ago

Attachment: div-widgets.diff added

Proposed patch

comment:1 by Chris Beaven, 17 years ago

See #4592 for alternative

comment:2 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by James Bennett, 17 years ago

Resolution: duplicate
Status: newclosed

Closing in favor of #4592.

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