Probably you will need to create your custom widget and override the method:
def id_for_label(self, id_): # See the comment for RadioSelect.id_for_label() if id_: id_ += '_0' return id_ id_for_label = classmethod(id_for_label) at the checkboxmultiple widget. hope this helps, Kind Regards, Sergio Hinojosa On Nov 28, 9:44 am, Alfonso <[EMAIL PROTECTED]> wrote: > I'd like to specify a unique id for each checkbox iteration in a > CheckboxSelectMultiple setup. This is what I have so far: > > grading = forms.BooleanField(label="Site Grading", > widget=forms.CheckboxSelectMultiple(choices=grading_choices)) > > So in my form using the tag {{ form.grading }} gives me: > > <ul> > <li><label for="id_grading_0"><input type="checkbox" name="grading" > value="1" id="id_grading_0" /> 1 star</label></li> > > <li><label for="id_grading_1"><input type="checkbox" name="grading" > value="2" id="id_grading_1" /> 2 stars</label></li> > <li><label for="id_grading_2"><input type="checkbox" name="grading" > value="3" id="id_grading_2" /> 3 stars</label></li> > <li><label for="id_grading_3"><input type="checkbox" name="grading" > value="4" id="id_grading_3" /> 4 stars</label></li> > <li><label for="id_grading_4"><input type="checkbox" name="grading" > value="5" id="id_grading_4" /> 5 stars</label></li> > </ul> > > So is there any way I can apply a corresponding css id to the label? > like id_grading_1_label? > > Its so I can add a background graphic or bullet, I can't apply a > background graphic to an input - only the label (as far as I know). > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---