On Fri, 2008-07-11 at 14:57 -0700, Tim wrote: > I would like some finer control over the display of a > MultipleChoiceField, but I'm not sure how to get to the individual > components (in my case, checkboxes). For example, if I define the > field in the form like so: > > tags = > forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, > choices=tag_list,) > > then I would like to be able to control the resulting HTML of the > individual checkboxes, and not just the checkboxes with label wrappers > as a whole (via as_p or as_table or whatever) - I thought it might be > possible to access by name or id (since forms has access to this > information during rendering), but that doesn't seem to be the case.
A bunch of the output you're wanting to control is generated by the widget class. Since all the code is set up in a fairly self-contained object-based manner, customising this is mostly a matter of subclassing the right widget classes and passing in your custom widget to the form field class. Have a look at the existing source in django.newforms.widgets and django.newforms.fields to see how it's done. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---