Opened 8 years ago

Closed 8 years ago

#4080 closed (duplicate)

newforms.widgets.RadioWidget should set attributes on the ul tag it renders

Reported by: Iwan Vosloo Owned by: adrian
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

It seems that RadioWidget does not render its HTML attributes passed in via attrs.

This is django.newforms.widgets.RadioWidget in the svn branch http://code.djangoproject.com/svn/django/trunk (revision 5023).

So, if you have a form:

class AForm(django.newforms.Form):
    widget = django.newforms.widgets.RadioSelect(attrs={'class':'radioselect'})
    field = django.newforms.fields.ChoiceField(choices=[('one', 'One'),('two', 'Two')],
                                               widget=widget)

then you would expect calling as_p on it (for example) to include a
class="radioselect" on, say, the ul that is generated. This does not
happen, neither does the ul have an id.

Attachments (1)

patch.diff (1.1 KB) - added by Iwan Vosloo 8 years ago.
Possible patch

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Iwan Vosloo

Possible patch

comment:1 Changed 8 years ago by Gary Wilson <gary.wilson@…>

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #3870.

comment:2 Changed 8 years ago by Gary Wilson <gary.wilson@…>

  • Resolution duplicate deleted
  • Status changed from closed to reopened
  • Summary changed from newforms.widgets.RadioWidget does not render its attrs to newforms.widgets.RadioWidget should set attributes on the ul tag it renders
  • Triage Stage changed from Unreviewed to Accepted

I am re-opening this for the request of adding attributes to the <ul>, which wasn't covered in #3870.

comment:3 Changed 8 years ago by Gary Wilson <gary.wilson@…>

  • Resolution set to duplicate
  • Status changed from reopened to closed

#4117 supersedes this ticket. Let's focus effort there.

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