I wish there was an easy way to customize CheckboxSelectMultiple. The
widget library doesn't seem to have a well-defined customization
method beyond subclass, paste the superclass impl, and edit it. I
don't like the <ul>. I want to create a variant which shows thumbnails
for image choices.

On Jun 4, 4:18 am, LaundroMat <laun...@gmail.com> wrote:
> On Jun 4, 11:15 am, Tom Evans <tevans...@googlemail.com> wrote:
>
>
>
> > On Wed, 2009-06-03 at 14:28 -0700, LaundroMat wrote:
> > > Hi -
>
> > > I'm trying to change the way a ChoiceField (with widget =
> > > forms.RadioSelect) is being rendered in a template. Currently,
> > > rendering the form as_p() for instance, will return HTML such as:
> > > <ul>
> > > <li><label for="id_type_0"><input type="radio" id="id_type_0"
> > > value="1" name="type" />choice 1</label></li>
> > > <li>...</li>
> > > </ul>
>
> > > Is there a way to control how this ChoiceField is rendered? I'd like
> > > to use something else than an unordered list...
>
> > > Many thanks in advance,
>
> > > Mathieu
>
> > The RadioSelect widget takes an optional keyword argument 'renderer'
> > which allows you to pass in a custom class type to use as your renderer.
>
> > Your class should have a render() method, and accept the same
> > constructor arguments as the default RadioFieldRenderer - name, value,
> > attrs, choices. Check out django/forms/widgets.py for the gory details.
>
> > Tom
>
> Thanks for the informative reply!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to