Document how to customize widgets
|Reported by:||Ben Smith||Owned by:||Tim Graham|
|Cc:||fadeev, timograham@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be nice to have documentation on how to customize form widgets. Here's an example of something that I just figured out, and that would be nice to see in the documentation.
You can customize how a widget is rendered by overriding it's renderer.render method. This class renders radio buttons as a horizontal line, instead of in a list.
class HorizRadioRenderer(forms.RadioSelect.renderer): def render(self): """Outputs radios""" return mark_safe(u'\n'.join([u'%s\n' % w for w in self]))
Change History (17)
comment:11 Changed 5 years ago by
|Owner:||changed from fadeev to Tim Graham|
|Status:||reopened → new|